diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddCommunityVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddCommunityVoice.g.cs
index 3f6b735..88ab9bf 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddCommunityVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddCommunityVoice.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Add a community voice to the voice library
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task AddCommunityVoiceAsync(
global::RetellAI.AddCommunityVoiceRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Add a community voice to the voice library
@@ -29,6 +31,7 @@ public partial interface IRetellAiClient
///
/// Required for ElevenLabs only. User id of the voice owner.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task AddCommunityVoiceAsync(
@@ -36,6 +39,7 @@ public partial interface IRetellAiClient
string voiceName,
global::RetellAI.AddCommunityVoiceRequestVoiceProvider? voiceProvider = default,
string? publicUserId = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddKnowledgeBaseSources.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddKnowledgeBaseSources.g.cs
index 37f1702..6ad4da3 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddKnowledgeBaseSources.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.AddKnowledgeBaseSources.g.cs
@@ -11,12 +11,14 @@ public partial interface IRetellAiClient
/// Example: kb_1234567890
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task AddKnowledgeBaseSourcesAsync(
string knowledgeBaseId,
global::RetellAI.KnowledgeBaseAddSourcesRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Add sources to a knowledge base
@@ -34,6 +36,7 @@ public partial interface IRetellAiClient
/// URLs to be scraped and added to the knowledge base. Must be valid urls.
/// Example: [https://www.example.com, https://www.retellai.com]
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task AddKnowledgeBaseSourcesAsync(
@@ -41,6 +44,7 @@ public partial interface IRetellAiClient
global::System.Collections.Generic.IList? knowledgeBaseTexts = default,
global::System.Collections.Generic.IList? knowledgeBaseFiles = default,
global::System.Collections.Generic.IList? knowledgeBaseUrls = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CloneVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CloneVoice.g.cs
index 1d567dc..7cd99a3 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CloneVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CloneVoice.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Clone a voice from audio files
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CloneVoiceAsync(
global::RetellAI.CloneVoiceRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Clone a voice from audio files
@@ -26,12 +28,14 @@ public partial interface IRetellAiClient
///
/// Voice provider to use for cloning.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CloneVoiceAsync(
global::System.Collections.Generic.IList files,
string voiceName,
global::RetellAI.CloneVoiceRequestVoiceProvider voiceProvider,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateAgent.g.cs
index 1bd2614..3864fa7 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateAgent.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new agent
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateAgentAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new agent
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateAgentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchCall.g.cs
index f3693ad..721976a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchCall.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a batch call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateBatchCallAsync(
global::RetellAI.CreateBatchCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a batch call
@@ -38,6 +40,7 @@ public partial interface IRetellAiClient
///
/// Allowed calling windows in a specific timezone. Each window is a half-open interval [startMin, endMin) in minutes since 00:00 local time. Cross-midnight windows are NOT allowed (must satisfy startMin < endMin). `endMin = 1440` (24:00) is valid.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateBatchCallAsync(
@@ -47,6 +50,7 @@ public partial interface IRetellAiClient
double? triggerTimestamp = default,
int? reservedConcurrency = default,
global::RetellAI.CallTimeWindow? callTimeWindow = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchTest.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchTest.g.cs
index 35727c3..0c063fb 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchTest.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateBatchTest.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a batch test to run multiple test cases
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateBatchTestAsync(
global::RetellAI.CreateBatchTestRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a batch test to run multiple test cases
@@ -23,11 +25,13 @@ public partial interface IRetellAiClient
///
/// Response engine for test cases. Custom LLM is not supported.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateBatchTestAsync(
global::System.Collections.Generic.IList testCaseDefinitionIds,
global::RetellAI.RetellResponseEngine responseEngine,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChat.g.cs
index 8fbc03d..4acb600 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChat.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a chat session
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatAsync(
global::RetellAI.CreateChatRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a chat session
@@ -32,6 +34,7 @@ public partial interface IRetellAiClient
/// Add optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description. Only applicable for Response Engine.
/// Example: {"customer_name":"John Doe"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatAsync(
@@ -39,6 +42,7 @@ public partial interface IRetellAiClient
int? agentVersion = default,
object? metadata = default,
object? retellLlmDynamicVariables = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatAgent.g.cs
index d845915..8aafb4b 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatAgent.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new chat agent
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatAgentAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new chat agent
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatAgentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatCompletion.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatCompletion.g.cs
index c3a77dc..542fa79 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatCompletion.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateChatCompletion.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a chat completion message
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatCompletionAsync(
global::RetellAI.CreateChatCompletionRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a chat completion message
@@ -25,11 +27,13 @@ public partial interface IRetellAiClient
/// user message to generate agent chat completion.
/// Example: hi how are you doing?
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateChatCompletionAsync(
string chatId,
string content,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlow.g.cs
index 27945f8..250ce1d 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlow.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new Conversation Flow that can be attached to an agent. This is used to generate response output for the agent.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateConversationFlowAsync(
global::RetellAI.CreateConversationFlowRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new Conversation Flow that can be attached to an agent. This is used to generate response output for the agent.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateConversationFlowAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlowComponent.g.cs
index 0342f9f..891ab56 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateConversationFlowComponent.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new shared conversation flow component
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateConversationFlowComponentAsync(
global::RetellAI.CreateConversationFlowComponentRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new shared conversation flow component
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateConversationFlowComponentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateKnowledgeBase.g.cs
index b6fd8af..3c9b86a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateKnowledgeBase.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a new knowledge base
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateKnowledgeBaseAsync(
global::RetellAI.KnowledgeBaseRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new knowledge base
@@ -43,6 +45,7 @@ public partial interface IRetellAiClient
/// Minimum number of characters per chunk. Chunks smaller than this will be merged with adjacent chunks. Must be less than max_chunk_size. Immutable after creation. Default is 400.
/// Example: 400
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateKnowledgeBaseAsync(
@@ -53,6 +56,7 @@ public partial interface IRetellAiClient
bool? enableAutoRefresh = default,
int? maxChunkSize = default,
int? minChunkSize = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneCall.g.cs
index 5094af0..1e8e9bb 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneCall.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a new outbound phone call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreatePhoneCallAsync(
global::RetellAI.CreatePhoneCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new outbound phone call
@@ -51,6 +53,7 @@ public partial interface IRetellAiClient
/// If true, the e.164 validation will be ignored for the from_number. This can be useful when you want to dial to internal pseudo numbers. This only applies when you are using custom telephony and does not apply when you are using Retell Telephony. If omitted, the default value is false.
/// Example: true
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreatePhoneCallAsync(
@@ -63,6 +66,7 @@ public partial interface IRetellAiClient
object? retellLlmDynamicVariables = default,
global::System.Collections.Generic.Dictionary? customSipHeaders = default,
bool? ignoreE164Validation = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneNumber.g.cs
index 648da25..e4a8b92 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreatePhoneNumber.g.cs
@@ -10,11 +10,13 @@ public partial interface IRetellAiClient
/// Buy a new phone number & Bind agents
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreatePhoneNumberAsync(
global::RetellAI.CreatePhoneNumberRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Buy a new phone number & Bind agents
@@ -68,6 +70,7 @@ public partial interface IRetellAiClient
/// Enterprise only. Phone number to transfer inbound calls to when organization is in outage mode. Can be either a Retell phone number or an external number. Cannot be the same as this phone number, and cannot be a number that already has its own fallback configured (prevents nested forwarding).
/// Example: +14155551234
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreatePhoneNumberAsync(
@@ -84,6 +87,7 @@ public partial interface IRetellAiClient
string? phoneNumber = default,
string? transport = default,
string? fallbackNumber = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateRetellLLM.g.cs
index 7f4af8d..8a42120 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateRetellLLM.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new Retell LLM Response Engine that can be attached to an agent. This is used to generate response output for the agent.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateRetellLLMAsync(
global::RetellAI.RetellLlmRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new Retell LLM Response Engine that can be attached to an agent. This is used to generate response output for the agent.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateRetellLLMAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateSmsChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateSmsChat.g.cs
index 3672e0e..b3308e6 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateSmsChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateSmsChat.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Start an outbound SMS chat conversation with a phone number using the specified agent. The agent must be configured for chat mode. The initial SMS message will be automatically generated and sent based on the agent's configuration.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateSmsChatAsync(
global::RetellAI.CreateSmsChatRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Start an outbound SMS chat conversation with a phone number using the specified agent. The agent must be configured for chat mode. The initial SMS message will be automatically generated and sent based on the agent's configuration.
@@ -40,6 +42,7 @@ public partial interface IRetellAiClient
/// Add optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description. Only applicable for Response Engine.
/// Example: {"customer_name":"John Doe"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateSmsChatAsync(
@@ -49,6 +52,7 @@ public partial interface IRetellAiClient
int? overrideAgentVersion = default,
object? metadata = default,
object? retellLlmDynamicVariables = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateTestCaseDefinition.g.cs
index ff63efc..85e5a7b 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateTestCaseDefinition.g.cs
@@ -8,18 +8,22 @@ public partial interface IRetellAiClient
/// Create a new test case definition
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateTestCaseDefinitionAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new test case definition
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateTestCaseDefinitionAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateWebCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateWebCall.g.cs
index ac2ab15..853a354 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateWebCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.CreateWebCall.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Create a new web call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateWebCallAsync(
global::RetellAI.CreateWebCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new web call
@@ -43,6 +45,7 @@ public partial interface IRetellAiClient
/// Start the conversation in this state (stage). Must be a valid state name in the agent's Retell LLM. Only applicable when the agent uses Retell LLM with states. Ignored for conversation-flow agents.
/// Example: information_collection
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task CreateWebCallAsync(
@@ -53,6 +56,7 @@ public partial interface IRetellAiClient
object? retellLlmDynamicVariables = default,
string? currentNodeId = default,
string? currentState = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteAgent.g.cs
index 5de0472..de90dc9 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteAgent.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteCall.g.cs
index d3e3af2..b53d55c 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteCall.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 119c3f8e47135a29e65947eeb34cf12d
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteCallAsync(
string callId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteChatAgent.g.cs
index d036c4b..c2b2354 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteChatAgent.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteChatAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlow.g.cs
index 87ed4b8..d500abf 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlow.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Delete a conversation flow and all its versions
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteConversationFlowAsync(
string conversationFlowId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlowComponent.g.cs
index 192d4ea..1caa197 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteConversationFlowComponent.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Delete a shared conversation flow component. When deleting a shared component, creates local copies for all linked conversation flows.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteConversationFlowComponentAsync(
string conversationFlowComponentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBase.g.cs
index 684f8ff..aa55361 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBase.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: kb_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteKnowledgeBaseAsync(
string knowledgeBaseId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBaseSource.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBaseSource.g.cs
index 1f34a82..920b4e2 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBaseSource.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteKnowledgeBaseSource.g.cs
@@ -13,11 +13,13 @@ public partial interface IRetellAiClient
///
/// Example: source_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteKnowledgeBaseSourceAsync(
string knowledgeBaseId,
string sourceId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeletePhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeletePhoneNumber.g.cs
index eb4177b..7ef3dbe 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeletePhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeletePhoneNumber.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: +14157774444
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeletePhoneNumberAsync(
string phoneNumber,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteRetellLLM.g.cs
index 5514de8..ede5f10 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteRetellLLM.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteRetellLLMAsync(
string llmId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteTestCaseDefinition.g.cs
index d4f9a6a..ba5159b 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.DeleteTestCaseDefinition.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Delete a test case definition
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task DeleteTestCaseDefinitionAsync(
string testCaseDefinitionId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.EndChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.EndChat.g.cs
index 8dbf8d3..684f3b8 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.EndChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.EndChat.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task EndChatAsync(
string chatId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgent.g.cs
index 418fc15..d5aa0e3 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgent.g.cs
@@ -13,11 +13,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetAgentAsync(
string agentId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgentVersions.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgentVersions.g.cs
index dbac9da..637673f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgentVersions.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetAgentVersions.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> GetAgentVersionsAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetBatchTest.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetBatchTest.g.cs
index b3abe45..dda3467 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetBatchTest.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetBatchTest.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Get a batch test job by ID
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetBatchTestAsync(
string testCaseBatchJobId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCall.g.cs
index 0e8469c..a507780 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetCall.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 119c3f8e47135a29e65947eeb34cf12d
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetCallAsync(
string callId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChat.g.cs
index d128cc5..a1ef5fe 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChat.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetChatAsync(
string chatId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgent.g.cs
index d9b38a9..ad0f2a0 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgent.g.cs
@@ -13,11 +13,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetChatAgentAsync(
string agentId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgentVersions.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgentVersions.g.cs
index 39f07f8..91415a7 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgentVersions.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetChatAgentVersions.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> GetChatAgentVersionsAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConcurrency.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConcurrency.g.cs
index 1eebdef..ba5a057 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConcurrency.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConcurrency.g.cs
@@ -7,9 +7,11 @@ public partial interface IRetellAiClient
///
/// Get the current concurrency and concurrency limit of the org
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetConcurrencyAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlow.g.cs
index ecba606..f71878b 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlow.g.cs
@@ -11,11 +11,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetConversationFlowAsync(
string conversationFlowId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlowComponent.g.cs
index ae4dcfa..d8b57ee 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetConversationFlowComponent.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Get a shared conversation flow component
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetConversationFlowComponentAsync(
string conversationFlowComponentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetKnowledgeBase.g.cs
index 29733fa..9b2f0f8 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetKnowledgeBase.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: kb_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetKnowledgeBaseAsync(
string knowledgeBaseId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetMCPTools.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetMCPTools.g.cs
index 937a1c5..0e0353d 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetMCPTools.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetMCPTools.g.cs
@@ -19,6 +19,7 @@ public partial interface IRetellAiClient
///
/// Example: component-123
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> GetMCPToolsAsync(
@@ -26,6 +27,7 @@ public partial interface IRetellAiClient
string mcpId,
int? version = default,
string? componentId = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetPhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetPhoneNumber.g.cs
index c18e8ef..a396437 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetPhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetPhoneNumber.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: +14157774444
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetPhoneNumberAsync(
string phoneNumber,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetRetellLLM.g.cs
index fc327d5..ca4ae3c 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetRetellLLM.g.cs
@@ -13,11 +13,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetRetellLLMAsync(
string llmId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestCaseDefinition.g.cs
index 0be25d1..f1b5d8f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestCaseDefinition.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Get a test case definition by ID
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetTestCaseDefinitionAsync(
string testCaseDefinitionId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestRun.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestRun.g.cs
index 59fb138..7cc81ca 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestRun.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetTestRun.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// Get a test case job (test run) by ID
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetTestRunAsync(
string testCaseJobId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetVoice.g.cs
index 1b2ac33..9ab4dcc 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.GetVoice.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: retell-Cimo
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task GetVoiceAsync(
string voiceId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ImportPhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ImportPhoneNumber.g.cs
index c26a542..865ec8a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ImportPhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ImportPhoneNumber.g.cs
@@ -10,11 +10,13 @@ public partial interface IRetellAiClient
/// Import a phone number from custom telephony & Bind agents
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task ImportPhoneNumberAsync(
global::RetellAI.ImportPhoneNumberRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Import a phone number from custom telephony & Bind agents
@@ -65,6 +67,7 @@ public partial interface IRetellAiClient
/// Outbound transport protocol to update for the phone number. Valid values are "TLS", "TCP" and "UDP". Default is "TCP".
/// Example: TCP
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task ImportPhoneNumberAsync(
@@ -80,6 +83,7 @@ public partial interface IRetellAiClient
global::System.Collections.Generic.IList? allowedInboundCountryList = default,
global::System.Collections.Generic.IList? allowedOutboundCountryList = default,
string? transport = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListAgents.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListAgents.g.cs
index 4727ab0..cbbe533 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListAgents.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListAgents.g.cs
@@ -16,12 +16,14 @@ public partial interface IRetellAiClient
///
/// Example: 0
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListAgentsAsync(
int? limit = default,
string? paginationKey = default,
int? paginationKeyVersion = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTests.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTests.g.cs
index 8c17d68..8c76366 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTests.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTests.g.cs
@@ -11,6 +11,7 @@ public partial interface IRetellAiClient
///
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListBatchTestsAsync(
@@ -18,6 +19,7 @@ public partial interface IRetellAiClient
string? llmId = default,
string? conversationFlowId = default,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTestsV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTestsV2.g.cs
index 54f1c8b..5061236 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTestsV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListBatchTestsV2.g.cs
@@ -15,6 +15,7 @@ public partial interface IRetellAiClient
/// Default Value: 50
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListBatchTestsV2Async(
@@ -24,6 +25,7 @@ public partial interface IRetellAiClient
int? version = default,
int? limit = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListCalls.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListCalls.g.cs
index f76bd9b..ada5545 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListCalls.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListCalls.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Retrieve call details
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListCallsAsync(
global::RetellAI.ListCallsRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Retrieve call details
@@ -32,6 +34,7 @@ public partial interface IRetellAiClient
///
/// The pagination key to continue fetching the next page of calls. Pagination key is represented by a call id here, and it's exclusive (not included in the fetched calls). The last call id from the list calls is usually used as pagination key here. If not set, will start from the beginning.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListCallsAsync(
@@ -39,6 +42,7 @@ public partial interface IRetellAiClient
global::RetellAI.ListCallsRequestSortOrder? sortOrder = default,
int? limit = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChat.g.cs
index 10f1265..dedc6e4 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChat.g.cs
@@ -14,12 +14,14 @@ public partial interface IRetellAiClient
/// Default Value: 50
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListChatAsync(
global::RetellAI.ListChatSortOrder? sortOrder = default,
int? limit = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChatAgents.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChatAgents.g.cs
index e3dff04..2e70931 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChatAgents.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListChatAgents.g.cs
@@ -16,12 +16,14 @@ public partial interface IRetellAiClient
///
/// Example: 0
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListChatAgentsAsync(
int? limit = default,
string? paginationKey = default,
int? paginationKeyVersion = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponents.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponents.g.cs
index 21ac452..87a6c59 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponents.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponents.g.cs
@@ -7,9 +7,11 @@ public partial interface IRetellAiClient
///
/// List shared conversation flow components
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListConversationFlowComponentsAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponentsV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponentsV2.g.cs
index ed382bb..dc06ec4 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponentsV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlowComponentsV2.g.cs
@@ -14,12 +14,14 @@ public partial interface IRetellAiClient
/// Default Value: descending
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListConversationFlowComponentsV2Async(
int? limit = default,
global::RetellAI.ListConversationFlowComponentsV2SortOrder? sortOrder = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlows.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlows.g.cs
index 01f4779..c419e53 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlows.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListConversationFlows.g.cs
@@ -12,12 +12,14 @@ public partial interface IRetellAiClient
///
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListConversationFlowsAsync(
int? limit = default,
string? paginationKey = default,
int? paginationKeyVersion = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListExportRequestsV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListExportRequestsV2.g.cs
index 9f6457c..0b43a79 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListExportRequestsV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListExportRequestsV2.g.cs
@@ -14,12 +14,14 @@ public partial interface IRetellAiClient
/// Default Value: descending
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListExportRequestsV2Async(
int? limit = default,
global::RetellAI.ListExportRequestsV2SortOrder? sortOrder = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListKnowledgeBases.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListKnowledgeBases.g.cs
index b561fe5..35603bf 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListKnowledgeBases.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListKnowledgeBases.g.cs
@@ -7,9 +7,11 @@ public partial interface IRetellAiClient
///
/// List all knowledge bases
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListKnowledgeBasesAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbers.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbers.g.cs
index 8c30e94..9d21789 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbers.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbers.g.cs
@@ -7,9 +7,11 @@ public partial interface IRetellAiClient
///
/// List all phone numbers
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListPhoneNumbersAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbersV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbersV2.g.cs
index 0cc2cce..b0e19d8 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbersV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListPhoneNumbersV2.g.cs
@@ -14,12 +14,14 @@ public partial interface IRetellAiClient
/// Default Value: descending
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListPhoneNumbersV2Async(
int? limit = default,
global::RetellAI.ListPhoneNumbersV2SortOrder? sortOrder = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListRetellLLM.g.cs
index 72ea72d..bf95702 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListRetellLLM.g.cs
@@ -16,12 +16,14 @@ public partial interface IRetellAiClient
///
/// Example: 0
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListRetellLLMAsync(
int? limit = default,
string? paginationKey = default,
int? paginationKeyVersion = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitions.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitions.g.cs
index 1767aac..425510a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitions.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitions.g.cs
@@ -11,6 +11,7 @@ public partial interface IRetellAiClient
///
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListTestCaseDefinitionsAsync(
@@ -18,6 +19,7 @@ public partial interface IRetellAiClient
string? llmId = default,
string? conversationFlowId = default,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitionsV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitionsV2.g.cs
index f92f9de..657a4c5 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitionsV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestCaseDefinitionsV2.g.cs
@@ -15,6 +15,7 @@ public partial interface IRetellAiClient
/// Default Value: 50
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListTestCaseDefinitionsV2Async(
@@ -24,6 +25,7 @@ public partial interface IRetellAiClient
int? version = default,
int? limit = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRuns.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRuns.g.cs
index 54a0326..6f2d036 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRuns.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRuns.g.cs
@@ -8,10 +8,12 @@ public partial interface IRetellAiClient
/// List all test case jobs (test runs) for a batch test job
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListTestRunsAsync(
string testCaseBatchJobId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRunsV2.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRunsV2.g.cs
index a7a5567..2bd4dfa 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRunsV2.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListTestRunsV2.g.cs
@@ -12,12 +12,14 @@ public partial interface IRetellAiClient
/// Default Value: 50
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListTestRunsV2Async(
string testCaseBatchJobId,
int? limit = default,
string? paginationKey = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListVoices.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListVoices.g.cs
index ab7aa5f..b86c72a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListVoices.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.ListVoices.g.cs
@@ -7,9 +7,11 @@ public partial interface IRetellAiClient
///
/// List all voices available to the user
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListVoicesAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishAgent.g.cs
index 85d5352..4261bce 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishAgent.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task PublishAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishChatAgent.g.cs
index 6ec2a4c..1617983 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.PublishChatAgent.g.cs
@@ -10,10 +10,12 @@ public partial interface IRetellAiClient
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task PublishChatAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RegisterPhoneCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RegisterPhoneCall.g.cs
index 18b19e4..dfe636a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RegisterPhoneCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.RegisterPhoneCall.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Register a new phone call for custom telephony
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task RegisterPhoneCallAsync(
global::RetellAI.RegisterPhoneCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Register a new phone call for custom telephony
@@ -47,6 +49,7 @@ public partial interface IRetellAiClient
/// Add optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description. Only applicable for Response Engine.
/// Example: {"customer_name":"John Doe"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task RegisterPhoneCallAsync(
@@ -58,6 +61,7 @@ public partial interface IRetellAiClient
global::RetellAI.RegisterPhoneCallRequestDirection? direction = default,
object? metadata = default,
object? retellLlmDynamicVariables = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.SearchCommunityVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.SearchCommunityVoice.g.cs
index 816e494..4fd45a2 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.SearchCommunityVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.SearchCommunityVoice.g.cs
@@ -8,11 +8,13 @@ public partial interface IRetellAiClient
/// Search for community voices from voice providers
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task SearchCommunityVoiceAsync(
global::RetellAI.SearchCommunityVoiceRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Search for community voices from voice providers
@@ -23,11 +25,13 @@ public partial interface IRetellAiClient
///
/// Search query to find voices by name, description, or ID.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task SearchCommunityVoiceAsync(
string searchQuery,
global::RetellAI.SearchCommunityVoiceRequestVoiceProvider? voiceProvider = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs
index 4ec4da6..e9325de 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateAgent.g.cs
@@ -14,6 +14,7 @@ public partial interface IRetellAiClient
/// Example: 1
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateAgentAsync(
@@ -21,6 +22,7 @@ public partial interface IRetellAiClient
global::RetellAI.AgentRequest request,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update an existing agent's latest draft version
@@ -247,6 +249,7 @@ public partial interface IRetellAiClient
/// Whether the agent is public. When set to true, the agent is available for public agent preview link.
/// Example: false
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateAgentAsync(
@@ -308,6 +311,7 @@ public partial interface IRetellAiClient
global::RetellAI.VoiceHandbookConfig? handbookConfig = default,
string? timezone = default,
bool? isPublic = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateCallMetadata.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateCallMetadata.g.cs
index d695c42..63a6b03 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateCallMetadata.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateCallMetadata.g.cs
@@ -11,12 +11,14 @@ public partial interface IRetellAiClient
/// Example: call_a4441234567890777c4a4a123e6
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateCallMetadataAsync(
string callId,
global::RetellAI.UpdateCallMetadataRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update metadata and sensitive data storage settings for an existing call.
@@ -40,6 +42,7 @@ public partial interface IRetellAiClient
/// Custom attributes for the call
/// Example: {"custom_attribute_1":"value1","custom_attribute_2":"value2"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateCallMetadataAsync(
@@ -48,6 +51,7 @@ public partial interface IRetellAiClient
global::RetellAI.UpdateCallMetadataRequestDataStorageSetting? dataStorageSetting = default,
global::System.Collections.Generic.Dictionary? overrideDynamicVariables = default,
object? customAttributes = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs
index d000621..91ab878 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatAgent.g.cs
@@ -14,6 +14,7 @@ public partial interface IRetellAiClient
/// Example: 1
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateChatAgentAsync(
@@ -21,6 +22,7 @@ public partial interface IRetellAiClient
global::RetellAI.ChatAgentRequest request,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update an existing chat agent
@@ -106,6 +108,7 @@ public partial interface IRetellAiClient
/// Whether the agent is public. When set to true, the agent is available for public agent preview link.
/// Example: false
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateChatAgentAsync(
@@ -133,6 +136,7 @@ public partial interface IRetellAiClient
global::RetellAI.ChatHandbookConfig? handbookConfig = default,
string? timezone = default,
bool? isPublic = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatMetadata.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatMetadata.g.cs
index e1cc4a5..5431183 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatMetadata.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateChatMetadata.g.cs
@@ -11,12 +11,14 @@ public partial interface IRetellAiClient
/// Example: chat_98c1a2157aa0559144d67bb0729
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateChatMetadataAsync(
string chatId,
global::RetellAI.UpdateChatMetadataRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update metadata and sensitive data storage settings for an existing chat.
@@ -39,6 +41,7 @@ public partial interface IRetellAiClient
/// Custom attributes for the chat
/// Example: {"custom_attribute_1":"value1","custom_attribute_2":"value2"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateChatMetadataAsync(
@@ -47,6 +50,7 @@ public partial interface IRetellAiClient
global::RetellAI.UpdateChatMetadataRequestDataStorageSetting? dataStorageSetting = default,
global::System.Collections.Generic.Dictionary? overrideDynamicVariables = default,
object? customAttributes = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlow.g.cs
index b75935a..b855f2d 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlow.g.cs
@@ -12,6 +12,7 @@ public partial interface IRetellAiClient
/// Example: 1
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateConversationFlowAsync(
@@ -19,6 +20,7 @@ public partial interface IRetellAiClient
global::RetellAI.ConversationFlow request,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update an existing conversation flow
@@ -27,11 +29,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateConversationFlowAsync(
string conversationFlowId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlowComponent.g.cs
index 644ca8a..968e5ba 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateConversationFlowComponent.g.cs
@@ -9,12 +9,14 @@ public partial interface IRetellAiClient
///
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateConversationFlowComponentAsync(
string conversationFlowComponentId,
global::RetellAI.ConversationFlowComponent request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update an existing shared conversation flow component
@@ -45,6 +47,7 @@ public partial interface IRetellAiClient
///
/// Visual annotations displayed on the flow canvas.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateConversationFlowComponentAsync(
@@ -56,6 +59,7 @@ public partial interface IRetellAiClient
string? startNodeId = default,
global::RetellAI.ConversationFlowComponentBeginTagDisplayPosition? beginTagDisplayPosition = default,
global::System.Collections.Generic.IList? notes = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdatePhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdatePhoneNumber.g.cs
index c48f9c0..98949f1 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdatePhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdatePhoneNumber.g.cs
@@ -13,12 +13,14 @@ public partial interface IRetellAiClient
/// Example: +14157774444
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdatePhoneNumberAsync(
string phoneNumber,
global::RetellAI.UpdatePhoneNumberRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update agent bound to a purchased phone number
@@ -82,6 +84,7 @@ public partial interface IRetellAiClient
/// Enterprise only. Phone number to transfer inbound calls to when organization is in outage mode. Can be either a Retell phone number or an external number. Set to null to remove. Cannot be the same as this phone number, and cannot be a number that already has its own fallback configured (prevents nested forwarding).
/// Example: +14155551234
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdatePhoneNumberAsync(
@@ -101,6 +104,7 @@ public partial interface IRetellAiClient
string? authPassword = default,
string? transport = default,
string? fallbackNumber = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateRetellLLM.g.cs
index 120d85c..16ec181 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateRetellLLM.g.cs
@@ -14,6 +14,7 @@ public partial interface IRetellAiClient
/// Example: 1
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateRetellLLMAsync(
@@ -21,6 +22,7 @@ public partial interface IRetellAiClient
global::RetellAI.RetellLlmRequest request,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update an existing Retell LLM Response Engine
@@ -31,11 +33,13 @@ public partial interface IRetellAiClient
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateRetellLLMAsync(
string llmId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateTestCaseDefinition.g.cs
index bc212ec..3ccbfc7 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.UpdateTestCaseDefinition.g.cs
@@ -9,12 +9,14 @@ public partial interface IRetellAiClient
///
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateTestCaseDefinitionAsync(
string testCaseDefinitionId,
global::RetellAI.TestCaseDefinitionInput request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update a test case definition
@@ -41,6 +43,7 @@ public partial interface IRetellAiClient
///
/// Available LLM models for agents.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task UpdateTestCaseDefinitionAsync(
@@ -52,6 +55,7 @@ public partial interface IRetellAiClient
global::System.Collections.Generic.Dictionary? dynamicVariables = default,
global::System.Collections.Generic.IList? toolMocks = default,
global::RetellAI.LLMModel? llmModel = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.g.cs b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.g.cs
index 463aad7..a38c892 100644
--- a/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.IRetellAiClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IRetellAiClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::RetellAI.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/RetellAI/Generated/RetellAI.OptionsSupport.g.cs b/src/libs/RetellAI/Generated/RetellAI.OptionsSupport.g.cs
new file mode 100644
index 0000000..3d5375b
--- /dev/null
+++ b/src/libs/RetellAI/Generated/RetellAI.OptionsSupport.g.cs
@@ -0,0 +1,460 @@
+
+#nullable enable
+
+namespace RetellAI
+{
+ ///
+ /// Global defaults applied to generated SDK requests.
+ ///
+ public sealed class AutoSDKClientOptions
+ {
+ ///
+ /// Additional headers applied to every request after generated headers are set.
+ /// Entries with the same key overwrite earlier header values.
+ ///
+ public global::System.Collections.Generic.Dictionary Headers { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase);
+
+ ///
+ /// Additional query parameters appended to every request.
+ /// Request-level entries with the same key are appended after client defaults.
+ ///
+ public global::System.Collections.Generic.Dictionary QueryParameters { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal);
+
+ ///
+ /// Optional timeout applied to the full request execution.
+ ///
+ public global::System.TimeSpan? Timeout { get; set; }
+
+ ///
+ /// Default retry behavior for generated HTTP requests.
+ ///
+ public global::RetellAI.AutoSDKRetryOptions Retry { get; set; } = new global::RetellAI.AutoSDKRetryOptions();
+
+ ///
+ /// Overrides the client-wide response buffering mode when set.
+ ///
+ public bool? ReadResponseAsString { get; set; }
+
+ ///
+ /// Reusable hooks invoked for every generated SDK request.
+ ///
+ public global::System.Collections.Generic.List Hooks { get; } =
+ new global::System.Collections.Generic.List();
+
+ ///
+ /// Registers a hook for all requests issued by this client.
+ ///
+ ///
+ /// The current options instance.
+ public global::RetellAI.AutoSDKClientOptions AddHook(
+ global::RetellAI.IAutoSDKHook hook)
+ {
+ Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook)));
+ return this;
+ }
+ }
+
+ ///
+ /// Per-request overrides applied on top of .
+ ///
+ public sealed class AutoSDKRequestOptions
+ {
+ ///
+ /// Additional headers applied after generated and client-level headers.
+ ///
+ public global::System.Collections.Generic.Dictionary Headers { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase);
+
+ ///
+ /// Additional query parameters appended after generated and client-level query parameters.
+ ///
+ public global::System.Collections.Generic.Dictionary QueryParameters { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal);
+
+ ///
+ /// Optional timeout override for this request.
+ ///
+ public global::System.TimeSpan? Timeout { get; set; }
+
+ ///
+ /// Optional retry override for this request.
+ ///
+ public global::RetellAI.AutoSDKRetryOptions? Retry { get; set; }
+
+ ///
+ /// Overrides response buffering for this request when set.
+ ///
+ public bool? ReadResponseAsString { get; set; }
+ }
+
+ ///
+ /// Retry settings for generated HTTP requests.
+ ///
+ public sealed class AutoSDKRetryOptions
+ {
+ ///
+ /// Total number of attempts, including the initial request.
+ /// Values less than 1 are normalized to 1.
+ ///
+ public int MaxAttempts { get; set; } = 1;
+
+ ///
+ /// Optional fixed delay between retry attempts.
+ ///
+ public global::System.TimeSpan? Delay { get; set; }
+ }
+
+ ///
+ /// Runtime hook interface for generated SDK lifecycle events.
+ ///
+ public interface IAutoSDKHook
+ {
+ ///
+ /// Runs before a request is sent.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::RetellAI.AutoSDKHookContext context);
+
+ ///
+ /// Runs after a successful HTTP response is received.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::RetellAI.AutoSDKHookContext context);
+
+ ///
+ /// Runs after an error response or transport failure is observed.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::RetellAI.AutoSDKHookContext context);
+ }
+
+ ///
+ /// Convenience base type for request hooks with no-op defaults.
+ ///
+ public abstract class AutoSDKHook : global::RetellAI.IAutoSDKHook
+ {
+ ///
+ public virtual global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+
+ ///
+ public virtual global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+
+ ///
+ public virtual global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+ }
+
+ ///
+ /// Runtime metadata passed to generated SDK hooks.
+ ///
+ public sealed class AutoSDKHookContext
+ {
+ ///
+ /// The source OpenAPI operation id or generated fallback id.
+ ///
+ public string OperationId { get; set; } = string.Empty;
+
+ ///
+ /// The generated C# method name.
+ ///
+ public string MethodName { get; set; } = string.Empty;
+
+ ///
+ /// The OpenAPI path template for the operation.
+ ///
+ public string PathTemplate { get; set; } = string.Empty;
+
+ ///
+ /// The HTTP method used for the request.
+ ///
+ public string HttpMethod { get; set; } = string.Empty;
+
+ ///
+ /// The client's resolved base URI.
+ ///
+ public global::System.Uri? BaseUri { get; set; }
+
+ ///
+ /// The outgoing HTTP request for the current attempt.
+ ///
+ public global::System.Net.Http.HttpRequestMessage Request { get; set; } = null!;
+
+ ///
+ /// The HTTP response when one was received.
+ ///
+ public global::System.Net.Http.HttpResponseMessage? Response { get; set; }
+
+ ///
+ /// The transport or processing exception when one was observed.
+ ///
+ public global::System.Exception? Exception { get; set; }
+
+ ///
+ /// The client-wide runtime options.
+ ///
+ public global::RetellAI.AutoSDKClientOptions ClientOptions { get; set; } = null!;
+
+ ///
+ /// The per-request runtime options.
+ ///
+ public global::RetellAI.AutoSDKRequestOptions? RequestOptions { get; set; }
+
+ ///
+ /// The current attempt number, starting at 1.
+ ///
+ public int Attempt { get; set; }
+
+ ///
+ /// The total number of attempts allowed for this request.
+ ///
+ public int MaxAttempts { get; set; }
+
+ ///
+ /// Indicates whether the generated client will retry after this hook invocation.
+ ///
+ public bool WillRetry { get; set; }
+
+ ///
+ /// The effective cancellation token for the current request attempt.
+ ///
+ public global::System.Threading.CancellationToken CancellationToken { get; set; }
+ }
+
+ internal static class AutoSDKRequestOptionsSupport
+ {
+ internal static global::RetellAI.AutoSDKHookContext CreateHookContext(
+ string operationId,
+ string methodName,
+ string pathTemplate,
+ string httpMethod,
+ global::System.Uri? baseUri,
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Net.Http.HttpResponseMessage? response,
+ global::System.Exception? exception,
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions,
+ int attempt,
+ int maxAttempts,
+ bool willRetry,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ return new global::RetellAI.AutoSDKHookContext
+ {
+ OperationId = operationId ?? string.Empty,
+ MethodName = methodName ?? string.Empty,
+ PathTemplate = pathTemplate ?? string.Empty,
+ HttpMethod = httpMethod ?? string.Empty,
+ BaseUri = baseUri,
+ Request = request,
+ Response = response,
+ Exception = exception,
+ ClientOptions = clientOptions,
+ RequestOptions = requestOptions,
+ Attempt = attempt,
+ MaxAttempts = maxAttempts,
+ WillRetry = willRetry,
+ CancellationToken = cancellationToken,
+ };
+ }
+
+ internal static global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnBeforeRequestAsync(hookContext), context);
+ }
+
+ internal static global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterSuccessAsync(hookContext), context);
+ }
+
+ internal static global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterErrorAsync(hookContext), context);
+ }
+
+ internal static bool GetReadResponseAsString(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions,
+ bool fallbackValue)
+ {
+ return requestOptions?.ReadResponseAsString ??
+ clientOptions.ReadResponseAsString ??
+ fallbackValue;
+ }
+
+ internal static global::System.Threading.CancellationTokenSource? CreateTimeoutCancellationTokenSource(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ var timeout = requestOptions?.Timeout ?? clientOptions.Timeout;
+ if (!timeout.HasValue || timeout.Value <= global::System.TimeSpan.Zero)
+ {
+ return null;
+ }
+
+ var cancellationTokenSource = global::System.Threading.CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+ cancellationTokenSource.CancelAfter(timeout.Value);
+ return cancellationTokenSource;
+ }
+
+ internal static int GetMaxAttempts(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions,
+ bool supportsRetry)
+ {
+ if (!supportsRetry)
+ {
+ return 1;
+ }
+
+ var maxAttempts = requestOptions?.Retry?.MaxAttempts ??
+ clientOptions.Retry?.MaxAttempts ??
+ 1;
+ return maxAttempts < 1 ? 1 : maxAttempts;
+ }
+
+ internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ var delay = requestOptions?.Retry?.Delay ??
+ clientOptions.Retry?.Delay;
+ if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero)
+ {
+ return;
+ }
+
+ await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false);
+ }
+
+ internal static bool ShouldRetryStatusCode(
+ global::System.Net.HttpStatusCode statusCode)
+ {
+ return (int)statusCode switch
+ {
+ 408 => true,
+ 429 => true,
+ 500 => true,
+ 502 => true,
+ 503 => true,
+ 504 => true,
+ _ => false,
+ };
+ }
+
+ internal static string AppendQueryParameters(
+ string path,
+ global::System.Collections.Generic.Dictionary clientParameters,
+ global::System.Collections.Generic.Dictionary? requestParameters)
+ {
+ var hasClientParameters = clientParameters != null && clientParameters.Count > 0;
+ var hasRequestParameters = requestParameters != null && requestParameters.Count > 0;
+ if (!hasClientParameters && !hasRequestParameters)
+ {
+ return path;
+ }
+
+ var builder = new global::System.Text.StringBuilder(path ?? string.Empty);
+ var hasQuery = builder.ToString().Contains("?", global::System.StringComparison.Ordinal);
+ AppendParameters(builder, clientParameters, ref hasQuery);
+ AppendParameters(builder, requestParameters, ref hasQuery);
+ return builder.ToString();
+ }
+
+ internal static void ApplyHeaders(
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Collections.Generic.Dictionary clientHeaders,
+ global::System.Collections.Generic.Dictionary? requestHeaders)
+ {
+ ApplyHeadersCore(request, clientHeaders);
+ ApplyHeadersCore(request, requestHeaders);
+ }
+
+ private static void AppendParameters(
+ global::System.Text.StringBuilder builder,
+ global::System.Collections.Generic.Dictionary? parameters,
+ ref bool hasQuery)
+ {
+ if (parameters == null || parameters.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var parameter in parameters)
+ {
+ builder.Append(hasQuery ? '&' : '?');
+ builder.Append(global::System.Uri.EscapeDataString(parameter.Key));
+ builder.Append('=');
+ builder.Append(global::System.Uri.EscapeDataString(parameter.Value ?? string.Empty));
+ hasQuery = true;
+ }
+ }
+
+ private static void ApplyHeadersCore(
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Collections.Generic.Dictionary? headers)
+ {
+ if (headers == null || headers.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var header in headers)
+ {
+ request.Headers.Remove(header.Key);
+ request.Content?.Headers.Remove(header.Key);
+
+ if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty) &&
+ request.Content != null)
+ {
+ request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty);
+ }
+ }
+ }
+
+ private static async global::System.Threading.Tasks.Task InvokeHooksAsync(
+ global::RetellAI.AutoSDKClientOptions clientOptions,
+ global::System.Func callback,
+ global::RetellAI.AutoSDKHookContext context)
+ {
+ if (clientOptions.Hooks == null || clientOptions.Hooks.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var hook in clientOptions.Hooks)
+ {
+ if (hook == null)
+ {
+ continue;
+ }
+
+ await callback(hook, context).ConfigureAwait(false);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.PathBuilder.g.cs b/src/libs/RetellAI/Generated/RetellAI.PathBuilder.g.cs
index 58329d6..493e943 100644
--- a/src/libs/RetellAI/Generated/RetellAI.PathBuilder.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.PathBuilder.g.cs
@@ -275,6 +275,11 @@ public class EndPointAuthorization
///
public string Type { get; set; } = string.Empty;
+ ///
+ ///
+ ///
+ public string SchemeId { get; set; } = string.Empty;
+
///
///
///
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddCommunityVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddCommunityVoice.g.cs
index 37c04c0..ef8d079 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddCommunityVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddCommunityVoice.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessAddCommunityVoiceResponseContent(
/// Add a community voice to the voice library
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task AddCommunityVoiceAsync(
global::RetellAI.AddCommunityVoiceRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessAddCommunityVoiceResponseContent(
securityRequirements: s_AddCommunityVoiceSecurityRequirements,
operationName: "AddCommunityVoiceAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/add-community-voice",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/add-community-voice",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,270 +114,429 @@ partial void ProcessAddCommunityVoiceResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareAddCommunityVoiceRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAddCommunityVoiceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessAddCommunityVoiceResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.AddCommunityVoiceResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddCommunityVoice",
+ methodName: "AddCommunityVoiceAsync",
+ pathTemplate: "\"/add-community-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.AddCommunityVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddCommunityVoice",
+ methodName: "AddCommunityVoiceAsync",
+ pathTemplate: "\"/add-community-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.AddCommunityVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.AddCommunityVoiceResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.AddCommunityVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddCommunityVoice",
+ methodName: "AddCommunityVoiceAsync",
+ pathTemplate: "\"/add-community-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.AddCommunityVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.AddCommunityVoiceResponse3? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.AddCommunityVoiceResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.AddCommunityVoiceResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAddCommunityVoiceResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddCommunityVoice",
+ methodName: "AddCommunityVoiceAsync",
+ pathTemplate: "\"/add-community-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddCommunityVoice",
+ methodName: "AddCommunityVoiceAsync",
+ pathTemplate: "\"/add-community-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.AddCommunityVoiceResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.AddCommunityVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.AddCommunityVoiceResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.AddCommunityVoiceResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.AddCommunityVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.AddCommunityVoiceResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.AddCommunityVoiceResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.AddCommunityVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.AddCommunityVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.AddCommunityVoiceResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.AddCommunityVoiceResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessAddCommunityVoiceResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.AddCommunityVoiceResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.AddCommunityVoiceResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.AddCommunityVoiceResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.AddCommunityVoiceResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessAddCommunityVoiceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Add a community voice to the voice library
@@ -370,6 +553,7 @@ partial void ProcessAddCommunityVoiceResponseContent(
///
/// Required for ElevenLabs only. User id of the voice owner.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task AddCommunityVoiceAsync(
@@ -377,6 +561,7 @@ partial void ProcessAddCommunityVoiceResponseContent(
string voiceName,
global::RetellAI.AddCommunityVoiceRequestVoiceProvider? voiceProvider = default,
string? publicUserId = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.AddCommunityVoiceRequest
@@ -389,6 +574,7 @@ partial void ProcessAddCommunityVoiceResponseContent(
return await AddCommunityVoiceAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddKnowledgeBaseSources.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddKnowledgeBaseSources.g.cs
index b9f529d..5dcb11f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddKnowledgeBaseSources.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.AddKnowledgeBaseSources.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -49,12 +50,14 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
/// Example: kb_1234567890
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task AddKnowledgeBaseSourcesAsync(
string knowledgeBaseId,
global::RetellAI.KnowledgeBaseAddSourcesRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -72,22 +75,43 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
securityRequirements: s_AddKnowledgeBaseSourcesSecurityRequirements,
operationName: "AddKnowledgeBaseSourcesAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/add-knowledge-base-sources/{knowledgeBaseId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/add-knowledge-base-sources/{knowledgeBaseId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -97,338 +121,497 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{knowledgeBaseId}"),
- name: "\"knowledge_base_id\"");
- if (request.KnowledgeBaseTexts != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseTexts, x => x))}]"),
- name: "\"knowledge_base_texts\"");
- }
- if (request.KnowledgeBaseFiles != default)
- {
-
- for (var __iKnowledgeBaseFiles = 0; __iKnowledgeBaseFiles < request.KnowledgeBaseFiles.Count; __iKnowledgeBaseFiles++)
- {
- var __contentKnowledgeBaseFiles = new global::System.Net.Http.ByteArrayContent(request.KnowledgeBaseFiles[__iKnowledgeBaseFiles]);
- __httpRequestContent.Add(
- content: __contentKnowledgeBaseFiles,
- name: "\"knowledge_base_files\"",
- fileName: $"\"file{__iKnowledgeBaseFiles}.bin\"");
- if (__contentKnowledgeBaseFiles.Headers.ContentDisposition != null)
- {
- __contentKnowledgeBaseFiles.Headers.ContentDisposition.FileNameStar = null;
- }
- }
- }
- if (request.KnowledgeBaseUrls != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseUrls, x => x))}]"),
- name: "\"knowledge_base_urls\"");
+ }
}
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareAddKnowledgeBaseSourcesRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- knowledgeBaseId: knowledgeBaseId,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessAddKnowledgeBaseSourcesResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.AddKnowledgeBaseSourcesResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.AddKnowledgeBaseSourcesResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.AddKnowledgeBaseSourcesResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{knowledgeBaseId}"),
+ name: "\"knowledge_base_id\"");
+ if (request.KnowledgeBaseTexts != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseTexts, x => x))}]"),
+ name: "\"knowledge_base_texts\"");
+ }
+ if (request.KnowledgeBaseFiles != default)
+ {
+
+ for (var __iKnowledgeBaseFiles = 0; __iKnowledgeBaseFiles < request.KnowledgeBaseFiles.Count; __iKnowledgeBaseFiles++)
+ {
+ var __contentKnowledgeBaseFiles = new global::System.Net.Http.ByteArrayContent(request.KnowledgeBaseFiles[__iKnowledgeBaseFiles]);
+ __httpRequestContent.Add(
+ content: __contentKnowledgeBaseFiles,
+ name: "\"knowledge_base_files\"",
+ fileName: $"\"file{__iKnowledgeBaseFiles}.bin\"");
+ if (__contentKnowledgeBaseFiles.Headers.ContentDisposition != null)
+ {
+ __contentKnowledgeBaseFiles.Headers.ContentDisposition.FileNameStar = null;
+ }
+ }
+ }
+ if (request.KnowledgeBaseUrls != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseUrls, x => x))}]"),
+ name: "\"knowledge_base_urls\"");
+ }
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAddKnowledgeBaseSourcesRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ knowledgeBaseId: knowledgeBaseId,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.AddKnowledgeBaseSourcesResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.AddKnowledgeBaseSourcesResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.AddKnowledgeBaseSourcesResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.AddKnowledgeBaseSourcesResponse3? __value_402 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddKnowledgeBaseSources",
+ methodName: "AddKnowledgeBaseSourcesAsync",
+ pathTemplate: "$\"/add-knowledge-base-sources/{knowledgeBaseId}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.AddKnowledgeBaseSourcesResponse3.FromJson(__content_402, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.AddKnowledgeBaseSourcesResponse3.FromJson(__content_402, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddKnowledgeBaseSources",
+ methodName: "AddKnowledgeBaseSourcesAsync",
+ pathTemplate: "$\"/add-knowledge-base-sources/{knowledgeBaseId}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.AddKnowledgeBaseSourcesResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.AddKnowledgeBaseSourcesResponse4.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddKnowledgeBaseSources",
+ methodName: "AddKnowledgeBaseSourcesAsync",
+ pathTemplate: "$\"/add-knowledge-base-sources/{knowledgeBaseId}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.AddKnowledgeBaseSourcesResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.AddKnowledgeBaseSourcesResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.AddKnowledgeBaseSourcesResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.AddKnowledgeBaseSourcesResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessAddKnowledgeBaseSourcesResponseContent(
+ response: __response);
+ ProcessAddKnowledgeBaseSourcesResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddKnowledgeBaseSources",
+ methodName: "AddKnowledgeBaseSourcesAsync",
+ pathTemplate: "$\"/add-knowledge-base-sources/{knowledgeBaseId}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddKnowledgeBaseSources",
+ methodName: "AddKnowledgeBaseSourcesAsync",
+ pathTemplate: "$\"/add-knowledge-base-sources/{knowledgeBaseId}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.AddKnowledgeBaseSourcesResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.AddKnowledgeBaseSourcesResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.AddKnowledgeBaseSourcesResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.AddKnowledgeBaseSourcesResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.AddKnowledgeBaseSourcesResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.AddKnowledgeBaseSourcesResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.AddKnowledgeBaseSourcesResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.AddKnowledgeBaseSourcesResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.AddKnowledgeBaseSourcesResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.AddKnowledgeBaseSourcesResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.AddKnowledgeBaseSourcesResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.AddKnowledgeBaseSourcesResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.AddKnowledgeBaseSourcesResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.AddKnowledgeBaseSourcesResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.AddKnowledgeBaseSourcesResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessAddKnowledgeBaseSourcesResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Add sources to a knowledge base
@@ -446,6 +629,7 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
/// URLs to be scraped and added to the knowledge base. Must be valid urls.
/// Example: [https://www.example.com, https://www.retellai.com]
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task AddKnowledgeBaseSourcesAsync(
@@ -453,6 +637,7 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
global::System.Collections.Generic.IList? knowledgeBaseTexts = default,
global::System.Collections.Generic.IList? knowledgeBaseFiles = default,
global::System.Collections.Generic.IList? knowledgeBaseUrls = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.KnowledgeBaseAddSourcesRequest
@@ -465,6 +650,7 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
return await AddKnowledgeBaseSourcesAsync(
knowledgeBaseId: knowledgeBaseId,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.Authorizations.Bearer.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.Authorizations.Bearer.g.cs
index eec4867..ae93ff2 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.Authorizations.Bearer.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.Authorizations.Bearer.g.cs
@@ -25,6 +25,7 @@ public void AuthorizeUsingBearer(
Authorizations.Add(new global::RetellAI.EndPointAuthorization
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
Value = apiKey,
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CloneVoice.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CloneVoice.g.cs
index 51b834a..6e681a5 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CloneVoice.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CloneVoice.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCloneVoiceResponseContent(
/// Clone a voice from audio files
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CloneVoiceAsync(
global::RetellAI.CloneVoiceRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCloneVoiceResponseContent(
securityRequirements: s_CloneVoiceSecurityRequirements,
operationName: "CloneVoiceAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/clone-voice",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/clone-voice",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,322 +114,481 @@ partial void ProcessCloneVoiceResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
- for (var __iFiles = 0; __iFiles < request.Files.Count; __iFiles++)
- {
- var __contentFiles = new global::System.Net.Http.ByteArrayContent(request.Files[__iFiles]);
- __httpRequestContent.Add(
- content: __contentFiles,
- name: "\"files\"",
- fileName: $"\"file{__iFiles}.bin\"");
- if (__contentFiles.Headers.ContentDisposition != null)
- {
- __contentFiles.Headers.ContentDisposition.FileNameStar = null;
- }
+ }
}
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.VoiceName}"),
- name: "\"voice_name\"");
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.VoiceProvider.ToValueString()}"),
- name: "\"voice_provider\"");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCloneVoiceRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCloneVoiceResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CloneVoiceResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CloneVoiceResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CloneVoiceResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ for (var __iFiles = 0; __iFiles < request.Files.Count; __iFiles++)
+ {
+ var __contentFiles = new global::System.Net.Http.ByteArrayContent(request.Files[__iFiles]);
+ __httpRequestContent.Add(
+ content: __contentFiles,
+ name: "\"files\"",
+ fileName: $"\"file{__iFiles}.bin\"");
+ if (__contentFiles.Headers.ContentDisposition != null)
+ {
+ __contentFiles.Headers.ContentDisposition.FileNameStar = null;
+ }
+ }
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.VoiceName}"),
+ name: "\"voice_name\"");
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.VoiceProvider.ToValueString()}"),
+ name: "\"voice_provider\"");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCloneVoiceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CloneVoiceResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CloneVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CloneVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CloneVoiceResponse3? __value_402 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CloneVoice",
+ methodName: "CloneVoiceAsync",
+ pathTemplate: "\"/clone-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CloneVoiceResponse3.FromJson(__content_402, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CloneVoiceResponse3.FromJson(__content_402, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CloneVoice",
+ methodName: "CloneVoiceAsync",
+ pathTemplate: "\"/clone-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CloneVoiceResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CloneVoiceResponse4.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CloneVoice",
+ methodName: "CloneVoiceAsync",
+ pathTemplate: "\"/clone-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CloneVoiceResponse4.FromJson(__content_429, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CloneVoiceResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CloneVoiceResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CloneVoiceResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCloneVoiceResponseContent(
+ response: __response);
+ ProcessCloneVoiceResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CloneVoice",
+ methodName: "CloneVoiceAsync",
+ pathTemplate: "\"/clone-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CloneVoice",
+ methodName: "CloneVoiceAsync",
+ pathTemplate: "\"/clone-voice\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CloneVoiceResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CloneVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CloneVoiceResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CloneVoiceResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CloneVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CloneVoiceResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CloneVoiceResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CloneVoiceResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CloneVoiceResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CloneVoiceResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CloneVoiceResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CloneVoiceResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CloneVoiceResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CloneVoiceResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CloneVoiceResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCloneVoiceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.VoiceResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- return
- await global::RetellAI.VoiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Clone a voice from audio files
@@ -419,12 +602,14 @@ partial void ProcessCloneVoiceResponseContent(
///
/// Voice provider to use for cloning.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CloneVoiceAsync(
global::System.Collections.Generic.IList files,
string voiceName,
global::RetellAI.CloneVoiceRequestVoiceProvider voiceProvider,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CloneVoiceRequest
@@ -436,6 +621,7 @@ partial void ProcessCloneVoiceResponseContent(
return await CloneVoiceAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateAgent.g.cs
index 337267b..f8f03de 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateAgentResponseContent(
/// Create a new agent
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateAgentAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateAgentResponseContent(
securityRequirements: s_CreateAgentSecurityRequirements,
operationName: "CreateAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-agent",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-agent",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,277 +112,438 @@ partial void ProcessCreateAgentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateAgent",
+ methodName: "CreateAgentAsync",
+ pathTemplate: "\"/create-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateAgent",
+ methodName: "CreateAgentAsync",
+ pathTemplate: "\"/create-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateAgent",
+ methodName: "CreateAgentAsync",
+ pathTemplate: "\"/create-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateAgentResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateAgent",
+ methodName: "CreateAgentAsync",
+ pathTemplate: "\"/create-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateAgent",
+ methodName: "CreateAgentAsync",
+ pathTemplate: "\"/create-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.CreateAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.CreateAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateAgentResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateAgentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.CreateAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.AgentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.AgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateAgentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.AgentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.AgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new agent
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateAgentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.AllOf
@@ -367,6 +552,7 @@ partial void ProcessCreateAgentResponseContent(
return await CreateAgentAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchCall.g.cs
index 1c63bde..c07f64f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchCall.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateBatchCallResponseContent(
/// Create a batch call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateBatchCallAsync(
global::RetellAI.CreateBatchCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateBatchCallResponseContent(
securityRequirements: s_CreateBatchCallSecurityRequirements,
operationName: "CreateBatchCallAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-batch-call",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-batch-call",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,270 +114,429 @@ partial void ProcessCreateBatchCallResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateBatchCallRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateBatchCallRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateBatchCallResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateBatchCallResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchCall",
+ methodName: "CreateBatchCallAsync",
+ pathTemplate: "\"/create-batch-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateBatchCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchCall",
+ methodName: "CreateBatchCallAsync",
+ pathTemplate: "\"/create-batch-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateBatchCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateBatchCallResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateBatchCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchCall",
+ methodName: "CreateBatchCallAsync",
+ pathTemplate: "\"/create-batch-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateBatchCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateBatchCallResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateBatchCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateBatchCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateBatchCallResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchCall",
+ methodName: "CreateBatchCallAsync",
+ pathTemplate: "\"/create-batch-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchCall",
+ methodName: "CreateBatchCallAsync",
+ pathTemplate: "\"/create-batch-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateBatchCallResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateBatchCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateBatchCallResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateBatchCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateBatchCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.CreateBatchCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateBatchCallResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateBatchCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.CreateBatchCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateBatchCallResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateBatchCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateBatchCallResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.CreateBatchCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateBatchCallResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateBatchCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.BatchCallResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateBatchCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.BatchCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateBatchCallResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.BatchCallResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.BatchCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a batch call
@@ -379,6 +562,7 @@ partial void ProcessCreateBatchCallResponseContent(
///
/// Allowed calling windows in a specific timezone. Each window is a half-open interval [startMin, endMin) in minutes since 00:00 local time. Cross-midnight windows are NOT allowed (must satisfy startMin < endMin). `endMin = 1440` (24:00) is valid.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateBatchCallAsync(
@@ -388,6 +572,7 @@ partial void ProcessCreateBatchCallResponseContent(
double? triggerTimestamp = default,
int? reservedConcurrency = default,
global::RetellAI.CallTimeWindow? callTimeWindow = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateBatchCallRequest
@@ -402,6 +587,7 @@ partial void ProcessCreateBatchCallResponseContent(
return await CreateBatchCallAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchTest.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchTest.g.cs
index 436d5de..acf88b8 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchTest.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateBatchTest.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateBatchTestResponseContent(
/// Create a batch test to run multiple test cases
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateBatchTestAsync(
global::RetellAI.CreateBatchTestRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateBatchTestResponseContent(
securityRequirements: s_CreateBatchTestSecurityRequirements,
operationName: "CreateBatchTestAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-batch-test",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-batch-test",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,308 +114,467 @@ partial void ProcessCreateBatchTestResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateBatchTestRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateBatchTestResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateBatchTestResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateBatchTestRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateBatchTestResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateBatchTestResponse3? __value_402 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchTest",
+ methodName: "CreateBatchTestAsync",
+ pathTemplate: "\"/create-batch-test\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateBatchTestResponse3.FromJson(__content_402, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateBatchTestResponse3.FromJson(__content_402, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchTest",
+ methodName: "CreateBatchTestAsync",
+ pathTemplate: "\"/create-batch-test\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateBatchTestResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchTest",
+ methodName: "CreateBatchTestAsync",
+ pathTemplate: "\"/create-batch-test\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateBatchTestResponse5? __value_500 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateBatchTestResponseContent(
+ response: __response);
+ ProcessCreateBatchTestResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.TestCaseBatchJob.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchTest",
+ methodName: "CreateBatchTestAsync",
+ pathTemplate: "\"/create-batch-test\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.TestCaseBatchJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateBatchTest",
+ methodName: "CreateBatchTestAsync",
+ pathTemplate: "\"/create-batch-test\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateBatchTestResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateBatchTestResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateBatchTestResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateBatchTestResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateBatchTestResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateBatchTestResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateBatchTestResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateBatchTestResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.TestCaseBatchJob.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.TestCaseBatchJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a batch test to run multiple test cases
@@ -402,11 +585,13 @@ partial void ProcessCreateBatchTestResponseContent(
///
/// Response engine for test cases. Custom LLM is not supported.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateBatchTestAsync(
global::System.Collections.Generic.IList testCaseDefinitionIds,
global::RetellAI.RetellResponseEngine responseEngine,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateBatchTestRequest
@@ -417,6 +602,7 @@ partial void ProcessCreateBatchTestResponseContent(
return await CreateBatchTestAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChat.g.cs
index dbbeb6d..5c50189 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChat.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateChatResponseContent(
/// Create a chat session
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatAsync(
global::RetellAI.CreateChatRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateChatResponseContent(
securityRequirements: s_CreateChatSecurityRequirements,
operationName: "CreateChatAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-chat",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-chat",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,346 +114,505 @@ partial void ProcessCreateChatResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateChatRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateChatResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateChatResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateChatResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateChatResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateChatResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreateChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateChatRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateChatResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateChatResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateChatResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateChatResponse4? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChat",
+ methodName: "CreateChatAsync",
+ pathTemplate: "\"/create-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::RetellAI.CreateChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChat",
+ methodName: "CreateChatAsync",
+ pathTemplate: "\"/create-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateChatResponse5? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChat",
+ methodName: "CreateChatAsync",
+ pathTemplate: "\"/create-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateChatResponse5.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateChatResponse6? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateChatResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateChatResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateChatResponseContent(
+ response: __response);
+ ProcessCreateChatResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChat",
+ methodName: "CreateChatAsync",
+ pathTemplate: "\"/create-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChat",
+ methodName: "CreateChatAsync",
+ pathTemplate: "\"/create-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateChatResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateChatResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateChatResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateChatResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateChatResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateChatResponse4? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::RetellAI.CreateChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateChatResponse5? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateChatResponse6? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateChatResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateChatResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateChatResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a chat session
@@ -449,6 +632,7 @@ partial void ProcessCreateChatResponseContent(
/// Add optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description. Only applicable for Response Engine.
/// Example: {"customer_name":"John Doe"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatAsync(
@@ -456,6 +640,7 @@ partial void ProcessCreateChatResponseContent(
int? agentVersion = default,
object? metadata = default,
object? retellLlmDynamicVariables = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateChatRequest
@@ -468,6 +653,7 @@ partial void ProcessCreateChatResponseContent(
return await CreateChatAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatAgent.g.cs
index bf8937a..b1acdbe 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateChatAgentResponseContent(
/// Create a new chat agent
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatAgentAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateChatAgentResponseContent(
securityRequirements: s_CreateChatAgentSecurityRequirements,
operationName: "CreateChatAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-chat-agent",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-chat-agent",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,277 +112,438 @@ partial void ProcessCreateChatAgentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateChatAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateChatAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateChatAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateChatAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatAgent",
+ methodName: "CreateChatAgentAsync",
+ pathTemplate: "\"/create-chat-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatAgent",
+ methodName: "CreateChatAgentAsync",
+ pathTemplate: "\"/create-chat-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateChatAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatAgent",
+ methodName: "CreateChatAgentAsync",
+ pathTemplate: "\"/create-chat-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateChatAgentResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateChatAgentResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateChatAgentResponse3.FromJson(__content_402, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateChatAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatAgent",
+ methodName: "CreateChatAgentAsync",
+ pathTemplate: "\"/create-chat-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_402 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatAgent",
+ methodName: "CreateChatAgentAsync",
+ pathTemplate: "\"/create-chat-agent\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateChatAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateChatAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.CreateChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateChatAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.CreateChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateChatAgentResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateChatAgentResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateChatAgentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_402 = global::RetellAI.CreateChatAgentResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateChatAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ChatAgentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ChatAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateChatAgentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ChatAgentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ChatAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new chat agent
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatAgentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.AllOf
@@ -367,6 +552,7 @@ partial void ProcessCreateChatAgentResponseContent(
return await CreateChatAgentAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatCompletion.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatCompletion.g.cs
index 168e518..b9ef22a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatCompletion.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateChatCompletion.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateChatCompletionResponseContent(
/// Create a chat completion message
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatCompletionAsync(
global::RetellAI.CreateChatCompletionRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateChatCompletionResponseContent(
securityRequirements: s_CreateChatCompletionSecurityRequirements,
operationName: "CreateChatCompletionAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-chat-completion",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-chat-completion",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,346 +114,505 @@ partial void ProcessCreateChatCompletionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateChatCompletionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateChatCompletionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateChatCompletionResponse2? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateChatCompletionResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateChatCompletionResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateChatCompletionResponse3? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateChatCompletionResponse3.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreateChatCompletionResponse3.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateChatCompletionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateChatCompletionResponse4? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateChatCompletionResponse4.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateChatCompletionResponse4.FromJson(__content_402, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateChatCompletionResponse5? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatCompletion",
+ methodName: "CreateChatCompletionAsync",
+ pathTemplate: "\"/create-chat-completion\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateChatCompletionResponse5.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::RetellAI.CreateChatCompletionResponse5.FromJson(__content_422, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatCompletion",
+ methodName: "CreateChatCompletionAsync",
+ pathTemplate: "\"/create-chat-completion\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateChatCompletionResponse6? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateChatCompletionResponse6.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatCompletion",
+ methodName: "CreateChatCompletionAsync",
+ pathTemplate: "\"/create-chat-completion\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateChatCompletionResponse6.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateChatCompletionResponse7? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateChatCompletionResponse7.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateChatCompletionResponse7.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateChatCompletionResponseContent(
+ response: __response);
+ ProcessCreateChatCompletionResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatCompletion",
+ methodName: "CreateChatCompletionAsync",
+ pathTemplate: "\"/create-chat-completion\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateChatCompletion",
+ methodName: "CreateChatCompletionAsync",
+ pathTemplate: "\"/create-chat-completion\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateChatCompletionResponse2? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateChatCompletionResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateChatCompletionResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateChatCompletionResponse3? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateChatCompletionResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateChatCompletionResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateChatCompletionResponse4? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateChatCompletionResponse4.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateChatCompletionResponse4.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateChatCompletionResponse5? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateChatCompletionResponse5.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::RetellAI.CreateChatCompletionResponse5.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateChatCompletionResponse6? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateChatCompletionResponse6.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateChatCompletionResponse6.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateChatCompletionResponse7? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateChatCompletionResponse7.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateChatCompletionResponse7.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateChatCompletionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a chat completion message
@@ -442,11 +625,13 @@ partial void ProcessCreateChatCompletionResponseContent(
/// user message to generate agent chat completion.
/// Example: hi how are you doing?
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateChatCompletionAsync(
string chatId,
string content,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateChatCompletionRequest
@@ -457,6 +642,7 @@ partial void ProcessCreateChatCompletionResponseContent(
return await CreateChatCompletionAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlow.g.cs
index 080e7e6..a262b43 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlow.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateConversationFlowResponseContent(
/// Create a new Conversation Flow that can be attached to an agent. This is used to generate response output for the agent.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateConversationFlowAsync(
global::RetellAI.CreateConversationFlowRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateConversationFlowResponseContent(
securityRequirements: s_CreateConversationFlowSecurityRequirements,
operationName: "CreateConversationFlowAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-conversation-flow",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-conversation-flow",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,315 +112,476 @@ partial void ProcessCreateConversationFlowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateConversationFlowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateConversationFlowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateConversationFlowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateConversationFlowResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlow",
+ methodName: "CreateConversationFlowAsync",
+ pathTemplate: "\"/create-conversation-flow\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlow",
+ methodName: "CreateConversationFlowAsync",
+ pathTemplate: "\"/create-conversation-flow\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateConversationFlowResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlow",
+ methodName: "CreateConversationFlowAsync",
+ pathTemplate: "\"/create-conversation-flow\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateConversationFlowResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateConversationFlowResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateConversationFlowResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateConversationFlowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlow",
+ methodName: "CreateConversationFlowAsync",
+ pathTemplate: "\"/create-conversation-flow\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlow",
+ methodName: "CreateConversationFlowAsync",
+ pathTemplate: "\"/create-conversation-flow\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateConversationFlowResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateConversationFlowResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.CreateConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateConversationFlowResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateConversationFlowResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.CreateConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateConversationFlowResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateConversationFlowResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_422 = global::RetellAI.CreateConversationFlowResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateConversationFlowResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateConversationFlowResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.CreateConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateConversationFlowResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ConversationFlowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ConversationFlowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateConversationFlowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ConversationFlowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ConversationFlowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new Conversation Flow that can be attached to an agent. This is used to generate response output for the agent.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateConversationFlowAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateConversationFlowRequest
@@ -405,6 +590,7 @@ partial void ProcessCreateConversationFlowResponseContent(
return await CreateConversationFlowAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlowComponent.g.cs
index 68ec0a5..e1ef804 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateConversationFlowComponent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateConversationFlowComponentResponseContent(
/// Create a new shared conversation flow component
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateConversationFlowComponentAsync(
global::RetellAI.CreateConversationFlowComponentRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateConversationFlowComponentResponseContent(
securityRequirements: s_CreateConversationFlowComponentSecurityRequirements,
operationName: "CreateConversationFlowComponentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-conversation-flow-component",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-conversation-flow-component",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,315 +112,476 @@ partial void ProcessCreateConversationFlowComponentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateConversationFlowComponentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateConversationFlowComponentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateConversationFlowComponentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateConversationFlowComponentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlowComponent",
+ methodName: "CreateConversationFlowComponentAsync",
+ pathTemplate: "\"/create-conversation-flow-component\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateConversationFlowComponentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlowComponent",
+ methodName: "CreateConversationFlowComponentAsync",
+ pathTemplate: "\"/create-conversation-flow-component\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateConversationFlowComponentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateConversationFlowComponentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateConversationFlowComponentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlowComponent",
+ methodName: "CreateConversationFlowComponentAsync",
+ pathTemplate: "\"/create-conversation-flow-component\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateConversationFlowComponentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.CreateConversationFlowComponentResponse3? __value_404 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.CreateConversationFlowComponentResponse3.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.CreateConversationFlowComponentResponse3.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateConversationFlowComponentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlowComponent",
+ methodName: "CreateConversationFlowComponentAsync",
+ pathTemplate: "\"/create-conversation-flow-component\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateConversationFlowComponent",
+ methodName: "CreateConversationFlowComponentAsync",
+ pathTemplate: "\"/create-conversation-flow-component\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateConversationFlowComponentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateConversationFlowComponentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateConversationFlowComponentResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateConversationFlowComponentResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateConversationFlowComponentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.CreateConversationFlowComponentResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateConversationFlowComponentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateConversationFlowComponentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateConversationFlowComponentResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateConversationFlowComponentResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateConversationFlowComponentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.CreateConversationFlowComponentResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.CreateConversationFlowComponentResponse3? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.CreateConversationFlowComponentResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.CreateConversationFlowComponentResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateConversationFlowComponentResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateConversationFlowComponentResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateConversationFlowComponentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.CreateConversationFlowComponentResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateConversationFlowComponentResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateConversationFlowComponentResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ConversationFlowComponentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateConversationFlowComponentResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ConversationFlowComponentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateConversationFlowComponentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ConversationFlowComponentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ConversationFlowComponentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new shared conversation flow component
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateConversationFlowComponentAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateConversationFlowComponentRequest
@@ -405,6 +590,7 @@ partial void ProcessCreateConversationFlowComponentResponseContent(
return await CreateConversationFlowComponentAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateKnowledgeBase.g.cs
index 15b5ff4..51d89f4 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateKnowledgeBase.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
/// Create a new knowledge base
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateKnowledgeBaseAsync(
global::RetellAI.KnowledgeBaseRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
securityRequirements: s_CreateKnowledgeBaseSecurityRequirements,
operationName: "CreateKnowledgeBaseAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-knowledge-base",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-knowledge-base",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,358 +114,517 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- using var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.KnowledgeBaseName}"),
- name: "\"knowledge_base_name\"");
- if (request.KnowledgeBaseTexts != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseTexts, x => x))}]"),
- name: "\"knowledge_base_texts\"");
- }
- if (request.KnowledgeBaseFiles != default)
- {
-
- for (var __iKnowledgeBaseFiles = 0; __iKnowledgeBaseFiles < request.KnowledgeBaseFiles.Count; __iKnowledgeBaseFiles++)
- {
- var __contentKnowledgeBaseFiles = new global::System.Net.Http.ByteArrayContent(request.KnowledgeBaseFiles[__iKnowledgeBaseFiles]);
- __httpRequestContent.Add(
- content: __contentKnowledgeBaseFiles,
- name: "\"knowledge_base_files\"",
- fileName: $"\"file{__iKnowledgeBaseFiles}.bin\"");
- if (__contentKnowledgeBaseFiles.Headers.ContentDisposition != null)
- {
- __contentKnowledgeBaseFiles.Headers.ContentDisposition.FileNameStar = null;
- }
- }
- }
- if (request.KnowledgeBaseUrls != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseUrls, x => x))}]"),
- name: "\"knowledge_base_urls\"");
- }
- if (request.EnableAutoRefresh != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.EnableAutoRefresh}"),
- name: "\"enable_auto_refresh\"");
- }
- if (request.MaxChunkSize != default)
- {
-
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.MaxChunkSize}"),
- name: "\"max_chunk_size\"");
- }
- if (request.MinChunkSize != default)
- {
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.KnowledgeBaseName}"),
+ name: "\"knowledge_base_name\"");
+ if (request.KnowledgeBaseTexts != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseTexts, x => x))}]"),
+ name: "\"knowledge_base_texts\"");
+ }
+ if (request.KnowledgeBaseFiles != default)
+ {
+
+ for (var __iKnowledgeBaseFiles = 0; __iKnowledgeBaseFiles < request.KnowledgeBaseFiles.Count; __iKnowledgeBaseFiles++)
+ {
+ var __contentKnowledgeBaseFiles = new global::System.Net.Http.ByteArrayContent(request.KnowledgeBaseFiles[__iKnowledgeBaseFiles]);
+ __httpRequestContent.Add(
+ content: __contentKnowledgeBaseFiles,
+ name: "\"knowledge_base_files\"",
+ fileName: $"\"file{__iKnowledgeBaseFiles}.bin\"");
+ if (__contentKnowledgeBaseFiles.Headers.ContentDisposition != null)
+ {
+ __contentKnowledgeBaseFiles.Headers.ContentDisposition.FileNameStar = null;
+ }
+ }
+ }
+ if (request.KnowledgeBaseUrls != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnowledgeBaseUrls, x => x))}]"),
+ name: "\"knowledge_base_urls\"");
+ }
+ if (request.EnableAutoRefresh != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.EnableAutoRefresh}"),
+ name: "\"enable_auto_refresh\"");
+ }
+ if (request.MaxChunkSize != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.MaxChunkSize}"),
+ name: "\"max_chunk_size\"");
+ }
+ if (request.MinChunkSize != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"{request.MinChunkSize}"),
+ name: "\"min_chunk_size\"");
+ }
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateKnowledgeBaseRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- __httpRequestContent.Add(
- content: new global::System.Net.Http.StringContent($"{request.MinChunkSize}"),
- name: "\"min_chunk_size\"");
+ return __httpRequest;
}
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateKnowledgeBaseRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateKnowledgeBaseResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateKnowledgeBaseResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateKnowledgeBaseResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateKnowledgeBaseResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateKnowledgeBaseResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateKnowledgeBaseResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreateKnowledgeBaseResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateKnowledgeBaseResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateKnowledgeBase",
+ methodName: "CreateKnowledgeBaseAsync",
+ pathTemplate: "\"/create-knowledge-base\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateKnowledgeBaseResponse3.FromJson(__content_402, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateKnowledgeBaseResponse3.FromJson(__content_402, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateKnowledgeBase",
+ methodName: "CreateKnowledgeBaseAsync",
+ pathTemplate: "\"/create-knowledge-base\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateKnowledgeBaseResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateKnowledgeBaseResponse4.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateKnowledgeBase",
+ methodName: "CreateKnowledgeBaseAsync",
+ pathTemplate: "\"/create-knowledge-base\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateKnowledgeBaseResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateKnowledgeBaseResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateKnowledgeBaseResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateKnowledgeBaseResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateKnowledgeBaseResponseContent(
+ response: __response);
+ ProcessCreateKnowledgeBaseResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateKnowledgeBase",
+ methodName: "CreateKnowledgeBaseAsync",
+ pathTemplate: "\"/create-knowledge-base\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateKnowledgeBase",
+ methodName: "CreateKnowledgeBaseAsync",
+ pathTemplate: "\"/create-knowledge-base\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateKnowledgeBaseResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateKnowledgeBaseResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateKnowledgeBaseResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateKnowledgeBaseResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateKnowledgeBaseResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateKnowledgeBaseResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateKnowledgeBaseResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateKnowledgeBaseResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateKnowledgeBaseResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateKnowledgeBaseResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateKnowledgeBaseResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateKnowledgeBaseResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateKnowledgeBaseResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateKnowledgeBaseResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateKnowledgeBaseResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateKnowledgeBaseResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- return
- await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new knowledge base
@@ -472,6 +655,7 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
/// Minimum number of characters per chunk. Chunks smaller than this will be merged with adjacent chunks. Must be less than max_chunk_size. Immutable after creation. Default is 400.
/// Example: 400
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateKnowledgeBaseAsync(
@@ -482,6 +666,7 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
bool? enableAutoRefresh = default,
int? maxChunkSize = default,
int? minChunkSize = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.KnowledgeBaseRequest
@@ -497,6 +682,7 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
return await CreateKnowledgeBaseAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneCall.g.cs
index 030b5e1..bd4a050 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneCall.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreatePhoneCallResponseContent(
/// Create a new outbound phone call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreatePhoneCallAsync(
global::RetellAI.CreatePhoneCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreatePhoneCallResponseContent(
securityRequirements: s_CreatePhoneCallSecurityRequirements,
operationName: "CreatePhoneCallAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/v2/create-phone-call",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/v2/create-phone-call",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,346 +114,505 @@ partial void ProcessCreatePhoneCallResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreatePhoneCallRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreatePhoneCallResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreatePhoneCallResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreatePhoneCallResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreatePhoneCallResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreatePhoneCallResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreatePhoneCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreatePhoneCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreatePhoneCallRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreatePhoneCallResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreatePhoneCallResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreatePhoneCallResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreatePhoneCallResponse4? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneCall",
+ methodName: "CreatePhoneCallAsync",
+ pathTemplate: "\"/v2/create-phone-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreatePhoneCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::RetellAI.CreatePhoneCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneCall",
+ methodName: "CreatePhoneCallAsync",
+ pathTemplate: "\"/v2/create-phone-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreatePhoneCallResponse5? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreatePhoneCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneCall",
+ methodName: "CreatePhoneCallAsync",
+ pathTemplate: "\"/v2/create-phone-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreatePhoneCallResponse5.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreatePhoneCallResponse6? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreatePhoneCallResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreatePhoneCallResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreatePhoneCallResponseContent(
+ response: __response);
+ ProcessCreatePhoneCallResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.V2PhoneCallResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneCall",
+ methodName: "CreatePhoneCallAsync",
+ pathTemplate: "\"/v2/create-phone-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.V2PhoneCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneCall",
+ methodName: "CreatePhoneCallAsync",
+ pathTemplate: "\"/v2/create-phone-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreatePhoneCallResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreatePhoneCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreatePhoneCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreatePhoneCallResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreatePhoneCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreatePhoneCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreatePhoneCallResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreatePhoneCallResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreatePhoneCallResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreatePhoneCallResponse4? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreatePhoneCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::RetellAI.CreatePhoneCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreatePhoneCallResponse5? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreatePhoneCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreatePhoneCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreatePhoneCallResponse6? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreatePhoneCallResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreatePhoneCallResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreatePhoneCallResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.V2PhoneCallResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.V2PhoneCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new outbound phone call
@@ -468,6 +651,7 @@ partial void ProcessCreatePhoneCallResponseContent(
/// If true, the e.164 validation will be ignored for the from_number. This can be useful when you want to dial to internal pseudo numbers. This only applies when you are using custom telephony and does not apply when you are using Retell Telephony. If omitted, the default value is false.
/// Example: true
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreatePhoneCallAsync(
@@ -480,6 +664,7 @@ partial void ProcessCreatePhoneCallResponseContent(
object? retellLlmDynamicVariables = default,
global::System.Collections.Generic.Dictionary? customSipHeaders = default,
bool? ignoreE164Validation = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreatePhoneCallRequest
@@ -497,6 +682,7 @@ partial void ProcessCreatePhoneCallResponseContent(
return await CreatePhoneCallAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneNumber.g.cs
index 727ab57..2ca7943 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreatePhoneNumber.g.cs
@@ -16,6 +16,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,11 +47,13 @@ partial void ProcessCreatePhoneNumberResponseContent(
/// Buy a new phone number & Bind agents
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreatePhoneNumberAsync(
global::RetellAI.CreatePhoneNumberRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -67,22 +70,43 @@ partial void ProcessCreatePhoneNumberResponseContent(
securityRequirements: s_CreatePhoneNumberSecurityRequirements,
operationName: "CreatePhoneNumberAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-phone-number",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-phone-number",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -92,232 +116,391 @@ partial void ProcessCreatePhoneNumberResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreatePhoneNumberRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreatePhoneNumberRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreatePhoneNumberResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreatePhoneNumberResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneNumber",
+ methodName: "CreatePhoneNumberAsync",
+ pathTemplate: "\"/create-phone-number\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreatePhoneNumberResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneNumber",
+ methodName: "CreatePhoneNumberAsync",
+ pathTemplate: "\"/create-phone-number\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreatePhoneNumberResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreatePhoneNumberResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreatePhoneNumberResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneNumber",
+ methodName: "CreatePhoneNumberAsync",
+ pathTemplate: "\"/create-phone-number\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreatePhoneNumberResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreatePhoneNumberResponse3? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreatePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreatePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreatePhoneNumberResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneNumber",
+ methodName: "CreatePhoneNumberAsync",
+ pathTemplate: "\"/create-phone-number\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_500 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePhoneNumber",
+ methodName: "CreatePhoneNumberAsync",
+ pathTemplate: "\"/create-phone-number\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreatePhoneNumberResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreatePhoneNumberResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::RetellAI.CreatePhoneNumberResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreatePhoneNumberResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreatePhoneNumberResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreatePhoneNumberResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::RetellAI.CreatePhoneNumberResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreatePhoneNumberResponse3? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreatePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.PhoneNumberResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreatePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.PhoneNumberResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreatePhoneNumberResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.PhoneNumberResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.PhoneNumberResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Buy a new phone number & Bind agents
@@ -371,6 +554,7 @@ partial void ProcessCreatePhoneNumberResponseContent(
/// Enterprise only. Phone number to transfer inbound calls to when organization is in outage mode. Can be either a Retell phone number or an external number. Cannot be the same as this phone number, and cannot be a number that already has its own fallback configured (prevents nested forwarding).
/// Example: +14155551234
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreatePhoneNumberAsync(
@@ -387,6 +571,7 @@ partial void ProcessCreatePhoneNumberResponseContent(
string? phoneNumber = default,
string? transport = default,
string? fallbackNumber = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreatePhoneNumberRequest
@@ -408,6 +593,7 @@ partial void ProcessCreatePhoneNumberResponseContent(
return await CreatePhoneNumberAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateRetellLLM.g.cs
index 347e9ae..bf73ba5 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateRetellLLM.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateRetellLLMResponseContent(
/// Create a new Retell LLM Response Engine that can be attached to an agent. This is used to generate response output for the agent.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateRetellLLMAsync(
global::RetellAI.RetellLlmRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateRetellLLMResponseContent(
securityRequirements: s_CreateRetellLLMSecurityRequirements,
operationName: "CreateRetellLLMAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-retell-llm",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-retell-llm",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,239 +112,400 @@ partial void ProcessCreateRetellLLMResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateRetellLLMRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateRetellLLMRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateRetellLLMResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateRetellLLMResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateRetellLLM",
+ methodName: "CreateRetellLLMAsync",
+ pathTemplate: "\"/create-retell-llm\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateRetellLLM",
+ methodName: "CreateRetellLLMAsync",
+ pathTemplate: "\"/create-retell-llm\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateRetellLLMResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateRetellLLM",
+ methodName: "CreateRetellLLMAsync",
+ pathTemplate: "\"/create-retell-llm\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateRetellLLMResponse3? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateRetellLLMResponse3.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateRetellLLMResponse3.FromJson(__content_500, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateRetellLLMResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateRetellLLM",
+ methodName: "CreateRetellLLMAsync",
+ pathTemplate: "\"/create-retell-llm\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_500 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateRetellLLM",
+ methodName: "CreateRetellLLMAsync",
+ pathTemplate: "\"/create-retell-llm\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateRetellLLMResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::RetellAI.CreateRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateRetellLLMResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateRetellLLMResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::RetellAI.CreateRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateRetellLLMResponse3? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateRetellLLMResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.RetellLLMResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateRetellLLMResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.RetellLLMResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateRetellLLMResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.RetellLLMResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.RetellLLMResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new Retell LLM Response Engine that can be attached to an agent. This is used to generate response output for the agent.
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateRetellLLMAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.RetellLlmRequest
@@ -329,6 +514,7 @@ partial void ProcessCreateRetellLLMResponseContent(
return await CreateRetellLLMAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateSmsChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateSmsChat.g.cs
index a16b970..e0026ea 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateSmsChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateSmsChat.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateSmsChatResponseContent(
/// Start an outbound SMS chat conversation with a phone number using the specified agent. The agent must be configured for chat mode. The initial SMS message will be automatically generated and sent based on the agent's configuration.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateSmsChatAsync(
global::RetellAI.CreateSmsChatRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateSmsChatResponseContent(
securityRequirements: s_CreateSmsChatSecurityRequirements,
operationName: "CreateSmsChatAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-sms-chat",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-sms-chat",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,346 +114,505 @@ partial void ProcessCreateSmsChatResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateSmsChatRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateSmsChatResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateSmsChatResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateSmsChatResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateSmsChatResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateSmsChatResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateSmsChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreateSmsChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateSmsChatRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateSmsChatResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateSmsChatResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateSmsChatResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateSmsChatResponse4? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSmsChat",
+ methodName: "CreateSmsChatAsync",
+ pathTemplate: "\"/create-sms-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateSmsChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::RetellAI.CreateSmsChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSmsChat",
+ methodName: "CreateSmsChatAsync",
+ pathTemplate: "\"/create-sms-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateSmsChatResponse5? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateSmsChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSmsChat",
+ methodName: "CreateSmsChatAsync",
+ pathTemplate: "\"/create-sms-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateSmsChatResponse5.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateSmsChatResponse6? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateSmsChatResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateSmsChatResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateSmsChatResponseContent(
+ response: __response);
+ ProcessCreateSmsChatResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSmsChat",
+ methodName: "CreateSmsChatAsync",
+ pathTemplate: "\"/create-sms-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSmsChat",
+ methodName: "CreateSmsChatAsync",
+ pathTemplate: "\"/create-sms-chat\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateSmsChatResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateSmsChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateSmsChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateSmsChatResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateSmsChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateSmsChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateSmsChatResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateSmsChatResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateSmsChatResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateSmsChatResponse4? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateSmsChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::RetellAI.CreateSmsChatResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateSmsChatResponse5? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateSmsChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateSmsChatResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateSmsChatResponse6? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateSmsChatResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateSmsChatResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateSmsChatResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Start an outbound SMS chat conversation with a phone number using the specified agent. The agent must be configured for chat mode. The initial SMS message will be automatically generated and sent based on the agent's configuration.
@@ -457,6 +640,7 @@ partial void ProcessCreateSmsChatResponseContent(
/// Add optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description. Only applicable for Response Engine.
/// Example: {"customer_name":"John Doe"}
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateSmsChatAsync(
@@ -466,6 +650,7 @@ partial void ProcessCreateSmsChatResponseContent(
int? overrideAgentVersion = default,
object? metadata = default,
object? retellLlmDynamicVariables = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateSmsChatRequest
@@ -480,6 +665,7 @@ partial void ProcessCreateSmsChatResponseContent(
return await CreateSmsChatAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateTestCaseDefinition.g.cs
index c806027..09ccf71 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateTestCaseDefinition.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateTestCaseDefinitionResponseContent(
/// Create a new test case definition
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateTestCaseDefinitionAsync(
global::RetellAI.AllOf request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCreateTestCaseDefinitionResponseContent(
securityRequirements: s_CreateTestCaseDefinitionSecurityRequirements,
operationName: "CreateTestCaseDefinitionAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/create-test-case-definition",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/create-test-case-definition",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,315 +112,476 @@ partial void ProcessCreateTestCaseDefinitionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateTestCaseDefinitionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTestCaseDefinitionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateTestCaseDefinitionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateTestCaseDefinitionResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTestCaseDefinition",
+ methodName: "CreateTestCaseDefinitionAsync",
+ pathTemplate: "\"/create-test-case-definition\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTestCaseDefinition",
+ methodName: "CreateTestCaseDefinitionAsync",
+ pathTemplate: "\"/create-test-case-definition\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.CreateTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateTestCaseDefinitionResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTestCaseDefinition",
+ methodName: "CreateTestCaseDefinitionAsync",
+ pathTemplate: "\"/create-test-case-definition\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateTestCaseDefinitionResponse3? __value_402 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateTestCaseDefinitionResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateTestCaseDefinitionResponse3.FromJson(__content_402, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTestCaseDefinitionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTestCaseDefinition",
+ methodName: "CreateTestCaseDefinitionAsync",
+ pathTemplate: "\"/create-test-case-definition\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_402 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTestCaseDefinition",
+ methodName: "CreateTestCaseDefinitionAsync",
+ pathTemplate: "\"/create-test-case-definition\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateTestCaseDefinitionResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateTestCaseDefinitionResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.CreateTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateTestCaseDefinitionResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateTestCaseDefinitionResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.CreateTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateTestCaseDefinitionResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateTestCaseDefinitionResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_402 = global::RetellAI.CreateTestCaseDefinitionResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateTestCaseDefinitionResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateTestCaseDefinitionResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.CreateTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateTestCaseDefinitionResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.TestCaseDefinition.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.TestCaseDefinition.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateTestCaseDefinitionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.TestCaseDefinition.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.TestCaseDefinition.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new test case definition
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateTestCaseDefinitionAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.AllOf
@@ -405,6 +590,7 @@ partial void ProcessCreateTestCaseDefinitionResponseContent(
return await CreateTestCaseDefinitionAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateWebCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateWebCall.g.cs
index 506f0b6..7157b89 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateWebCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.CreateWebCall.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,11 +45,13 @@ partial void ProcessCreateWebCallResponseContent(
/// Create a new web call
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateWebCallAsync(
global::RetellAI.CreateWebCallRequest request,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateWebCallResponseContent(
securityRequirements: s_CreateWebCallSecurityRequirements,
operationName: "CreateWebCallAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/v2/create-web-call",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/v2/create-web-call",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,346 +114,505 @@ partial void ProcessCreateWebCallResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateWebCallRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateWebCallResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.CreateWebCallResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.CreateWebCallResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::RetellAI.CreateWebCallResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.CreateWebCallResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.CreateWebCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::RetellAI.CreateWebCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateWebCallRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Payment Required
- if ((int)__response.StatusCode == 402)
- {
- string? __content_402 = null;
- global::System.Exception? __exception_402 = null;
- global::RetellAI.CreateWebCallResponse3? __value_402 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_402 = global::RetellAI.CreateWebCallResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- else
- {
- __content_402 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_402 = global::RetellAI.CreateWebCallResponse3.FromJson(__content_402, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_402 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_402,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_402,
- ResponseObject = __value_402,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.CreateWebCallResponse4? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWebCall",
+ methodName: "CreateWebCallAsync",
+ pathTemplate: "\"/v2/create-web-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.CreateWebCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::RetellAI.CreateWebCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWebCall",
+ methodName: "CreateWebCallAsync",
+ pathTemplate: "\"/v2/create-web-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.CreateWebCallResponse5? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateWebCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWebCall",
+ methodName: "CreateWebCallAsync",
+ pathTemplate: "\"/v2/create-web-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.CreateWebCallResponse5.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
+ break;
}
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.CreateWebCallResponse6? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.CreateWebCallResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::RetellAI.CreateWebCallResponse6.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateWebCallResponseContent(
+ response: __response);
+ ProcessCreateWebCallResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.V2WebCallResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWebCall",
+ methodName: "CreateWebCallAsync",
+ pathTemplate: "\"/v2/create-web-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
+ else
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::RetellAI.V2WebCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWebCall",
+ methodName: "CreateWebCallAsync",
+ pathTemplate: "\"/v2/create-web-call\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.CreateWebCallResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.CreateWebCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::RetellAI.CreateWebCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.CreateWebCallResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.CreateWebCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::RetellAI.CreateWebCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::RetellAI.CreateWebCallResponse3? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::RetellAI.CreateWebCallResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::RetellAI.CreateWebCallResponse3.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_402,
+ ResponseObject = __value_402,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.CreateWebCallResponse4? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.CreateWebCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::RetellAI.CreateWebCallResponse4.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.CreateWebCallResponse5? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.CreateWebCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::RetellAI.CreateWebCallResponse5.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.CreateWebCallResponse6? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.CreateWebCallResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.CreateWebCallResponse6.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateWebCallResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.V2WebCallResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.V2WebCallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new web call
@@ -460,6 +643,7 @@ partial void ProcessCreateWebCallResponseContent(
/// Start the conversation in this state (stage). Must be a valid state name in the agent's Retell LLM. Only applicable when the agent uses Retell LLM with states. Ignored for conversation-flow agents.
/// Example: information_collection
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task CreateWebCallAsync(
@@ -470,6 +654,7 @@ partial void ProcessCreateWebCallResponseContent(
object? retellLlmDynamicVariables = default,
string? currentNodeId = default,
string? currentState = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::RetellAI.CreateWebCallRequest
@@ -485,6 +670,7 @@ partial void ProcessCreateWebCallResponseContent(
return await CreateWebCallAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteAgent.g.cs
index ca69316..77d92f1 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeleteAgentResponse(
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeleteAgentResponse(
securityRequirements: s_DeleteAgentSecurityRequirements,
operationName: "DeleteAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-agent/{agentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-agent/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessDeleteAgentResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAgent",
+ methodName: "DeleteAgentAsync",
+ pathTemplate: "$\"/delete-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAgent",
+ methodName: "DeleteAgentAsync",
+ pathTemplate: "$\"/delete-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAgent",
+ methodName: "DeleteAgentAsync",
+ pathTemplate: "$\"/delete-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteAgentResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAgent",
+ methodName: "DeleteAgentAsync",
+ pathTemplate: "$\"/delete-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAgent",
+ methodName: "DeleteAgentAsync",
+ pathTemplate: "$\"/delete-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.DeleteAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteAgentResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.DeleteAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteCall.g.cs
index 3d677ac..8927b17 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteCall.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeleteCallResponse(
///
/// Example: 119c3f8e47135a29e65947eeb34cf12d
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteCallAsync(
string callId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeleteCallResponse(
securityRequirements: s_DeleteCallSecurityRequirements,
operationName: "DeleteCallAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/v2/delete-call/{callId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/v2/delete-call/{callId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessDeleteCallResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteCallRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- callId: callId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteCallRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ callId: callId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteCallResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteCallResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteCall",
+ methodName: "DeleteCallAsync",
+ pathTemplate: "$\"/v2/delete-call/{callId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteCall",
+ methodName: "DeleteCallAsync",
+ pathTemplate: "$\"/v2/delete-call/{callId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteCallResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteCall",
+ methodName: "DeleteCallAsync",
+ pathTemplate: "$\"/v2/delete-call/{callId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteCallResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteCallResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteCall",
+ methodName: "DeleteCallAsync",
+ pathTemplate: "$\"/v2/delete-call/{callId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteCall",
+ methodName: "DeleteCallAsync",
+ pathTemplate: "$\"/v2/delete-call/{callId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteCallResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteCallResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteCallResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.DeleteCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteCallResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.DeleteCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteCallResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteChatAgent.g.cs
index b6d7e90..ac4749d 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteChatAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeleteChatAgentResponse(
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteChatAgentAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeleteChatAgentResponse(
securityRequirements: s_DeleteChatAgentSecurityRequirements,
operationName: "DeleteChatAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-chat-agent/{agentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-chat-agent/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessDeleteChatAgentResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteChatAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteChatAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteChatAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteChatAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteChatAgent",
+ methodName: "DeleteChatAgentAsync",
+ pathTemplate: "$\"/delete-chat-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteChatAgent",
+ methodName: "DeleteChatAgentAsync",
+ pathTemplate: "$\"/delete-chat-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteChatAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteChatAgent",
+ methodName: "DeleteChatAgentAsync",
+ pathTemplate: "$\"/delete-chat-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteChatAgentResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteChatAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteChatAgent",
+ methodName: "DeleteChatAgentAsync",
+ pathTemplate: "$\"/delete-chat-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteChatAgent",
+ methodName: "DeleteChatAgentAsync",
+ pathTemplate: "$\"/delete-chat-agent/{agentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteChatAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteChatAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteChatAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.DeleteChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteChatAgentResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.DeleteChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteChatAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlow.g.cs
index 265e468..02631ca 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlow.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -39,10 +40,12 @@ partial void ProcessDeleteConversationFlowResponse(
/// Delete a conversation flow and all its versions
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteConversationFlowAsync(
string conversationFlowId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -57,22 +60,43 @@ partial void ProcessDeleteConversationFlowResponse(
securityRequirements: s_DeleteConversationFlowSecurityRequirements,
operationName: "DeleteConversationFlowAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-conversation-flow/{conversationFlowId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-conversation-flow/{conversationFlowId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -82,285 +106,444 @@ partial void ProcessDeleteConversationFlowResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteConversationFlowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- conversationFlowId: conversationFlowId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteConversationFlowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ conversationFlowId: conversationFlowId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteConversationFlowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteConversationFlowResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlow",
+ methodName: "DeleteConversationFlowAsync",
+ pathTemplate: "$\"/delete-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlow",
+ methodName: "DeleteConversationFlowAsync",
+ pathTemplate: "$\"/delete-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteConversationFlowResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlow",
+ methodName: "DeleteConversationFlowAsync",
+ pathTemplate: "$\"/delete-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.DeleteConversationFlowResponse3? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteConversationFlowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlow",
+ methodName: "DeleteConversationFlowAsync",
+ pathTemplate: "$\"/delete-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlow",
+ methodName: "DeleteConversationFlowAsync",
+ pathTemplate: "$\"/delete-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteConversationFlowResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.DeleteConversationFlowResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.DeleteConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteConversationFlowResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteConversationFlowResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.DeleteConversationFlowResponse3? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.DeleteConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.DeleteConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.DeleteConversationFlowResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.DeleteConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.DeleteConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteConversationFlowResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlowComponent.g.cs
index c73eaca..e9586b8 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteConversationFlowComponent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -39,10 +40,12 @@ partial void ProcessDeleteConversationFlowComponentResponse(
/// Delete a shared conversation flow component. When deleting a shared component, creates local copies for all linked conversation flows.
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteConversationFlowComponentAsync(
string conversationFlowComponentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -57,22 +60,43 @@ partial void ProcessDeleteConversationFlowComponentResponse(
securityRequirements: s_DeleteConversationFlowComponentSecurityRequirements,
operationName: "DeleteConversationFlowComponentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-conversation-flow-component/{conversationFlowComponentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-conversation-flow-component/{conversationFlowComponentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -82,247 +106,406 @@ partial void ProcessDeleteConversationFlowComponentResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteConversationFlowComponentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- conversationFlowComponentId: conversationFlowComponentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteConversationFlowComponentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ conversationFlowComponentId: conversationFlowComponentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteConversationFlowComponentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteConversationFlowComponentResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlowComponent",
+ methodName: "DeleteConversationFlowComponentAsync",
+ pathTemplate: "$\"/delete-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlowComponent",
+ methodName: "DeleteConversationFlowComponentAsync",
+ pathTemplate: "$\"/delete-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.DeleteConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.DeleteConversationFlowComponentResponse2? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlowComponent",
+ methodName: "DeleteConversationFlowComponentAsync",
+ pathTemplate: "$\"/delete-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.DeleteConversationFlowComponentResponse3? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteConversationFlowComponentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlowComponent",
+ methodName: "DeleteConversationFlowComponentAsync",
+ pathTemplate: "$\"/delete-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteConversationFlowComponent",
+ methodName: "DeleteConversationFlowComponentAsync",
+ pathTemplate: "$\"/delete-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteConversationFlowComponentResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteConversationFlowComponentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.DeleteConversationFlowComponentResponse2? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.DeleteConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.DeleteConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.DeleteConversationFlowComponentResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.DeleteConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.DeleteConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteConversationFlowComponentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBase.g.cs
index 248d0da..27a6238 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBase.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeleteKnowledgeBaseResponse(
///
/// Example: kb_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteKnowledgeBaseAsync(
string knowledgeBaseId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeleteKnowledgeBaseResponse(
securityRequirements: s_DeleteKnowledgeBaseSecurityRequirements,
operationName: "DeleteKnowledgeBaseAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-knowledge-base/{knowledgeBaseId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-knowledge-base/{knowledgeBaseId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessDeleteKnowledgeBaseResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteKnowledgeBaseRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- knowledgeBaseId: knowledgeBaseId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteKnowledgeBaseRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ knowledgeBaseId: knowledgeBaseId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteKnowledgeBaseResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteKnowledgeBaseResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBase",
+ methodName: "DeleteKnowledgeBaseAsync",
+ pathTemplate: "$\"/delete-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBase",
+ methodName: "DeleteKnowledgeBaseAsync",
+ pathTemplate: "$\"/delete-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.DeleteKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteKnowledgeBaseResponse2? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBase",
+ methodName: "DeleteKnowledgeBaseAsync",
+ pathTemplate: "$\"/delete-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.DeleteKnowledgeBaseResponse3? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteKnowledgeBaseResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBase",
+ methodName: "DeleteKnowledgeBaseAsync",
+ pathTemplate: "$\"/delete-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBase",
+ methodName: "DeleteKnowledgeBaseAsync",
+ pathTemplate: "$\"/delete-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteKnowledgeBaseResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteKnowledgeBaseResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteKnowledgeBaseResponse2? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_422 = global::RetellAI.DeleteKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.DeleteKnowledgeBaseResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.DeleteKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.DeleteKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteKnowledgeBaseResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBaseSource.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBaseSource.g.cs
index f539453..f1f3846 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBaseSource.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteKnowledgeBaseSource.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -51,11 +52,13 @@ partial void ProcessDeleteKnowledgeBaseSourceResponseContent(
///
/// Example: source_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteKnowledgeBaseSourceAsync(
string knowledgeBaseId,
string sourceId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -71,22 +74,43 @@ partial void ProcessDeleteKnowledgeBaseSourceResponseContent(
securityRequirements: s_DeleteKnowledgeBaseSourceSecurityRequirements,
operationName: "DeleteKnowledgeBaseSourceAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -96,265 +120,424 @@ partial void ProcessDeleteKnowledgeBaseSourceResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteKnowledgeBaseSourceRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- knowledgeBaseId: knowledgeBaseId,
- sourceId: sourceId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteKnowledgeBaseSourceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ knowledgeBaseId: knowledgeBaseId,
+ sourceId: sourceId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteKnowledgeBaseSourceResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteKnowledgeBaseSourceResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBaseSource",
+ methodName: "DeleteKnowledgeBaseSourceAsync",
+ pathTemplate: "$\"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteKnowledgeBaseSourceResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBaseSource",
+ methodName: "DeleteKnowledgeBaseSourceAsync",
+ pathTemplate: "$\"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.DeleteKnowledgeBaseSourceResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteKnowledgeBaseSourceResponse2? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteKnowledgeBaseSourceResponse2.FromJson(__content_422, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBaseSource",
+ methodName: "DeleteKnowledgeBaseSourceAsync",
+ pathTemplate: "$\"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteKnowledgeBaseSourceResponse2.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.DeleteKnowledgeBaseSourceResponse3? __value_429 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteKnowledgeBaseSourceResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteKnowledgeBaseSourceResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteKnowledgeBaseSourceResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBaseSource",
+ methodName: "DeleteKnowledgeBaseSourceAsync",
+ pathTemplate: "$\"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteKnowledgeBaseSource",
+ methodName: "DeleteKnowledgeBaseSourceAsync",
+ pathTemplate: "$\"/delete-knowledge-base-source/{knowledgeBaseId}/source/{sourceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteKnowledgeBaseSourceResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteKnowledgeBaseSourceResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteKnowledgeBaseSourceResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteKnowledgeBaseSourceResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteKnowledgeBaseSourceResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteKnowledgeBaseSourceResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteKnowledgeBaseSourceResponse2? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteKnowledgeBaseSourceResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_422 = global::RetellAI.DeleteKnowledgeBaseSourceResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.DeleteKnowledgeBaseSourceResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.DeleteKnowledgeBaseSourceResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDeleteKnowledgeBaseSourceResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.DeleteKnowledgeBaseSourceResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteKnowledgeBaseSourceResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteKnowledgeBaseSourceResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteKnowledgeBaseSourceResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessDeleteKnowledgeBaseSourceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeletePhoneNumber.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeletePhoneNumber.g.cs
index 322fa37..991b320 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeletePhoneNumber.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeletePhoneNumber.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeletePhoneNumberResponse(
///
/// Example: +14157774444
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeletePhoneNumberAsync(
string phoneNumber,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeletePhoneNumberResponse(
securityRequirements: s_DeletePhoneNumberSecurityRequirements,
operationName: "DeletePhoneNumberAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-phone-number/{phoneNumber}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-phone-number/{phoneNumber}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,209 +108,368 @@ partial void ProcessDeletePhoneNumberResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeletePhoneNumberRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- phoneNumber: phoneNumber);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeletePhoneNumberRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ phoneNumber: phoneNumber);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeletePhoneNumberResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeletePhoneNumberResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePhoneNumber",
+ methodName: "DeletePhoneNumberAsync",
+ pathTemplate: "$\"/delete-phone-number/{phoneNumber}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeletePhoneNumberResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePhoneNumber",
+ methodName: "DeletePhoneNumberAsync",
+ pathTemplate: "$\"/delete-phone-number/{phoneNumber}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.DeletePhoneNumberResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeletePhoneNumberResponse2? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeletePhoneNumberResponse2.FromJson(__content_422, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePhoneNumber",
+ methodName: "DeletePhoneNumberAsync",
+ pathTemplate: "$\"/delete-phone-number/{phoneNumber}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeletePhoneNumberResponse2.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeletePhoneNumberResponse3? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeletePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeletePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeletePhoneNumberResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePhoneNumber",
+ methodName: "DeletePhoneNumberAsync",
+ pathTemplate: "$\"/delete-phone-number/{phoneNumber}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_500 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePhoneNumber",
+ methodName: "DeletePhoneNumberAsync",
+ pathTemplate: "$\"/delete-phone-number/{phoneNumber}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeletePhoneNumberResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeletePhoneNumberResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.DeletePhoneNumberResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeletePhoneNumberResponse2? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeletePhoneNumberResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.DeletePhoneNumberResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeletePhoneNumberResponse3? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeletePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeletePhoneNumberResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteRetellLLM.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteRetellLLM.g.cs
index e636f3d..506030b 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteRetellLLM.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteRetellLLM.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessDeleteRetellLLMResponse(
///
/// Example: oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteRetellLLMAsync(
string llmId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessDeleteRetellLLMResponse(
securityRequirements: s_DeleteRetellLLMSecurityRequirements,
operationName: "DeleteRetellLLMAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-retell-llm/{llmId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-retell-llm/{llmId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessDeleteRetellLLMResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteRetellLLMRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- llmId: llmId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteRetellLLMRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ llmId: llmId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteRetellLLMResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteRetellLLMResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteRetellLLM",
+ methodName: "DeleteRetellLLMAsync",
+ pathTemplate: "$\"/delete-retell-llm/{llmId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteRetellLLM",
+ methodName: "DeleteRetellLLMAsync",
+ pathTemplate: "$\"/delete-retell-llm/{llmId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteRetellLLMResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteRetellLLM",
+ methodName: "DeleteRetellLLMAsync",
+ pathTemplate: "$\"/delete-retell-llm/{llmId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.DeleteRetellLLMResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteRetellLLMResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.DeleteRetellLLMResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteRetellLLMResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteRetellLLM",
+ methodName: "DeleteRetellLLMAsync",
+ pathTemplate: "$\"/delete-retell-llm/{llmId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteRetellLLM",
+ methodName: "DeleteRetellLLMAsync",
+ pathTemplate: "$\"/delete-retell-llm/{llmId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteRetellLLMResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteRetellLLMResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteRetellLLMResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteRetellLLMResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteRetellLLMResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteRetellLLMResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.DeleteRetellLLMResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.DeleteRetellLLMResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.DeleteRetellLLMResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.DeleteRetellLLMResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteRetellLLMResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteRetellLLMResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteRetellLLMResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteTestCaseDefinition.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteTestCaseDefinition.g.cs
index 62550c7..d7a6b26 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteTestCaseDefinition.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.DeleteTestCaseDefinition.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -39,10 +40,12 @@ partial void ProcessDeleteTestCaseDefinitionResponse(
/// Delete a test case definition
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task DeleteTestCaseDefinitionAsync(
string testCaseDefinitionId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -57,22 +60,43 @@ partial void ProcessDeleteTestCaseDefinitionResponse(
securityRequirements: s_DeleteTestCaseDefinitionSecurityRequirements,
operationName: "DeleteTestCaseDefinitionAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/delete-test-case-definition/{testCaseDefinitionId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/delete-test-case-definition/{testCaseDefinitionId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -82,285 +106,444 @@ partial void ProcessDeleteTestCaseDefinitionResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteTestCaseDefinitionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- testCaseDefinitionId: testCaseDefinitionId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteTestCaseDefinitionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ testCaseDefinitionId: testCaseDefinitionId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteTestCaseDefinitionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.DeleteTestCaseDefinitionResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteTestCaseDefinition",
+ methodName: "DeleteTestCaseDefinitionAsync",
+ pathTemplate: "$\"/delete-test-case-definition/{testCaseDefinitionId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.DeleteTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteTestCaseDefinition",
+ methodName: "DeleteTestCaseDefinitionAsync",
+ pathTemplate: "$\"/delete-test-case-definition/{testCaseDefinitionId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.DeleteTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.DeleteTestCaseDefinitionResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteTestCaseDefinition",
+ methodName: "DeleteTestCaseDefinitionAsync",
+ pathTemplate: "$\"/delete-test-case-definition/{testCaseDefinitionId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.DeleteTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.DeleteTestCaseDefinitionResponse3? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteTestCaseDefinitionResponse3.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.DeleteTestCaseDefinitionResponse3.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteTestCaseDefinitionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteTestCaseDefinition",
+ methodName: "DeleteTestCaseDefinitionAsync",
+ pathTemplate: "$\"/delete-test-case-definition/{testCaseDefinitionId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteTestCaseDefinition",
+ methodName: "DeleteTestCaseDefinitionAsync",
+ pathTemplate: "$\"/delete-test-case-definition/{testCaseDefinitionId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.DeleteTestCaseDefinitionResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.DeleteTestCaseDefinitionResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.DeleteTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.DeleteTestCaseDefinitionResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.DeleteTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.DeleteTestCaseDefinitionResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.DeleteTestCaseDefinitionResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.DeleteTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.DeleteTestCaseDefinitionResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.DeleteTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.DeleteTestCaseDefinitionResponse3? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.DeleteTestCaseDefinitionResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.DeleteTestCaseDefinitionResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.DeleteTestCaseDefinitionResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.DeleteTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.DeleteTestCaseDefinitionResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.DeleteTestCaseDefinitionResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.DeleteTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.DeleteTestCaseDefinitionResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.EndChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.EndChat.g.cs
index 7700519..e0fef71 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.EndChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.EndChat.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,10 +42,12 @@ partial void ProcessEndChatResponse(
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task EndChatAsync(
string chatId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -59,22 +62,43 @@ partial void ProcessEndChatResponse(
securityRequirements: s_EndChatSecurityRequirements,
operationName: "EndChatAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/end-chat/{chatId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/end-chat/{chatId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -84,247 +108,406 @@ partial void ProcessEndChatResponse(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareEndChatRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- chatId: chatId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareEndChatRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ chatId: chatId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessEndChatResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.EndChatResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "EndChat",
+ methodName: "EndChatAsync",
+ pathTemplate: "$\"/end-chat/{chatId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.EndChatResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "EndChat",
+ methodName: "EndChatAsync",
+ pathTemplate: "$\"/end-chat/{chatId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.EndChatResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.EndChatResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.EndChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "EndChat",
+ methodName: "EndChatAsync",
+ pathTemplate: "$\"/end-chat/{chatId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.EndChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.EndChatResponse3? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.EndChatResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.EndChatResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessEndChatResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "EndChat",
+ methodName: "EndChatAsync",
+ pathTemplate: "$\"/end-chat/{chatId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "EndChat",
+ methodName: "EndChatAsync",
+ pathTemplate: "$\"/end-chat/{chatId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.EndChatResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.EndChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.EndChatResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.EndChatResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.EndChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.EndChatResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.EndChatResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.EndChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.EndChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.EndChatResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.EndChatResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.EndChatResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.EndChatResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.EndChatResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.EndChatResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
- else
+ finally
{
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __httpRequest?.Dispose();
}
}
}
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgent.g.cs
index 0e2210b..dde6eb3 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -51,11 +52,13 @@ partial void ProcessGetAgentResponseContent(
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetAgentAsync(
string agentId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -71,25 +74,46 @@ partial void ProcessGetAgentResponseContent(
securityRequirements: s_GetAgentSecurityRequirements,
operationName: "GetAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-agent/{agentId}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-agent/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -99,265 +123,424 @@ partial void ProcessGetAgentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId,
- version: version);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId,
+ version: version);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgent",
+ methodName: "GetAgentAsync",
+ pathTemplate: "$\"/get-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgent",
+ methodName: "GetAgentAsync",
+ pathTemplate: "$\"/get-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgent",
+ methodName: "GetAgentAsync",
+ pathTemplate: "$\"/get-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetAgentResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgent",
+ methodName: "GetAgentAsync",
+ pathTemplate: "$\"/get-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgent",
+ methodName: "GetAgentAsync",
+ pathTemplate: "$\"/get-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetAgentResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetAgentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.AgentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.AgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetAgentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.AgentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.AgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgentVersions.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgentVersions.g.cs
index 37cfd28..8eed473 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgentVersions.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetAgentVersions.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,10 +47,12 @@ partial void ProcessGetAgentVersionsResponseContent(
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task> GetAgentVersionsAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetAgentVersionsResponseContent(
securityRequirements: s_GetAgentVersionsSecurityRequirements,
operationName: "GetAgentVersionsAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-agent-versions/{agentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-agent-versions/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,264 +113,423 @@ partial void ProcessGetAgentVersionsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetAgentVersionsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetAgentVersionsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetAgentVersionsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetAgentVersionsResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgentVersions",
+ methodName: "GetAgentVersionsAsync",
+ pathTemplate: "$\"/get-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetAgentVersionsResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgentVersions",
+ methodName: "GetAgentVersionsAsync",
+ pathTemplate: "$\"/get-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetAgentVersionsResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetAgentVersionsResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetAgentVersionsResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgentVersions",
+ methodName: "GetAgentVersionsAsync",
+ pathTemplate: "$\"/get-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetAgentVersionsResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetAgentVersionsResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetAgentVersionsResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetAgentVersionsResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetAgentVersionsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgentVersions",
+ methodName: "GetAgentVersionsAsync",
+ pathTemplate: "$\"/get-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAgentVersions",
+ methodName: "GetAgentVersionsAsync",
+ pathTemplate: "$\"/get-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetAgentVersionsResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetAgentVersionsResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetAgentVersionsResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetAgentVersionsResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetAgentVersionsResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetAgentVersionsResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetAgentVersionsResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetAgentVersionsResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetAgentVersionsResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetAgentVersionsResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetAgentVersionsResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetAgentVersionsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetAgentVersionsResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetAgentVersionsResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetAgentVersionsResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetAgentVersionsResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetAgentVersionsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetBatchTest.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetBatchTest.g.cs
index 3be8a30..b64092f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetBatchTest.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetBatchTest.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,10 +45,12 @@ partial void ProcessGetBatchTestResponseContent(
/// Get a batch test job by ID
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetBatchTestAsync(
string testCaseBatchJobId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetBatchTestResponseContent(
securityRequirements: s_GetBatchTestSecurityRequirements,
operationName: "GetBatchTestAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-batch-test/{testCaseBatchJobId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-batch-test/{testCaseBatchJobId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,302 +111,461 @@ partial void ProcessGetBatchTestResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetBatchTestRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- testCaseBatchJobId: testCaseBatchJobId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetBatchTestRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ testCaseBatchJobId: testCaseBatchJobId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetBatchTestResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetBatchTestResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchTest",
+ methodName: "GetBatchTestAsync",
+ pathTemplate: "$\"/get-batch-test/{testCaseBatchJobId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchTest",
+ methodName: "GetBatchTestAsync",
+ pathTemplate: "$\"/get-batch-test/{testCaseBatchJobId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetBatchTestResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchTest",
+ methodName: "GetBatchTestAsync",
+ pathTemplate: "$\"/get-batch-test/{testCaseBatchJobId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.GetBatchTestResponse3? __value_404 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetBatchTestResponse3.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetBatchTestResponse3.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetBatchTestResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchTest",
+ methodName: "GetBatchTestAsync",
+ pathTemplate: "$\"/get-batch-test/{testCaseBatchJobId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchTest",
+ methodName: "GetBatchTestAsync",
+ pathTemplate: "$\"/get-batch-test/{testCaseBatchJobId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetBatchTestResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.GetBatchTestResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetBatchTestResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.GetBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetBatchTestResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetBatchTestResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetBatchTestResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.GetBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.GetBatchTestResponse3? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.GetBatchTestResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.GetBatchTestResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.GetBatchTestResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.GetBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetBatchTestResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.GetBatchTestResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetBatchTestResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.TestCaseBatchJob.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetBatchTestResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.TestCaseBatchJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetBatchTestResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.TestCaseBatchJob.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.TestCaseBatchJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCall.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCall.g.cs
index e79cd78..65ec665 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCall.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetCall.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,10 +47,12 @@ partial void ProcessGetCallResponseContent(
///
/// Example: 119c3f8e47135a29e65947eeb34cf12d
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetCallAsync(
string callId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetCallResponseContent(
securityRequirements: s_GetCallSecurityRequirements,
operationName: "GetCallAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/v2/get-call/{callId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/v2/get-call/{callId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,264 +113,423 @@ partial void ProcessGetCallResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetCallRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- callId: callId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetCallRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ callId: callId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetCallResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetCallResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetCall",
+ methodName: "GetCallAsync",
+ pathTemplate: "$\"/v2/get-call/{callId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetCall",
+ methodName: "GetCallAsync",
+ pathTemplate: "$\"/v2/get-call/{callId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetCallResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetCallResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetCall",
+ methodName: "GetCallAsync",
+ pathTemplate: "$\"/v2/get-call/{callId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetCallResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetCallResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetCallResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetCallResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetCall",
+ methodName: "GetCallAsync",
+ pathTemplate: "$\"/v2/get-call/{callId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetCall",
+ methodName: "GetCallAsync",
+ pathTemplate: "$\"/v2/get-call/{callId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetCallResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetCallResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetCallResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetCallResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetCallResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetCallResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetCallResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetCallResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetCallResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetCallResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.V2CallResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetCallResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.V2CallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetCallResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.V2CallResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.V2CallResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChat.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChat.g.cs
index a7c5261..3583d7f 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChat.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChat.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,10 +47,12 @@ partial void ProcessGetChatResponseContent(
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetChatAsync(
string chatId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetChatResponseContent(
securityRequirements: s_GetChatSecurityRequirements,
operationName: "GetChatAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-chat/{chatId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-chat/{chatId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,264 +113,423 @@ partial void ProcessGetChatResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetChatRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- chatId: chatId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetChatRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ chatId: chatId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetChatResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetChatResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChat",
+ methodName: "GetChatAsync",
+ pathTemplate: "$\"/get-chat/{chatId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetChatResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChat",
+ methodName: "GetChatAsync",
+ pathTemplate: "$\"/get-chat/{chatId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetChatResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetChatResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChat",
+ methodName: "GetChatAsync",
+ pathTemplate: "$\"/get-chat/{chatId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetChatResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetChatResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetChatResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChat",
+ methodName: "GetChatAsync",
+ pathTemplate: "$\"/get-chat/{chatId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChat",
+ methodName: "GetChatAsync",
+ pathTemplate: "$\"/get-chat/{chatId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetChatResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetChatResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetChatResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetChatResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetChatResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetChatResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetChatResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetChatResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetChatResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetChatResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetChatResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetChatResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetChatResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ChatResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ChatResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgent.g.cs
index eeb7d87..f2bc49a 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -51,11 +52,13 @@ partial void ProcessGetChatAgentResponseContent(
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetChatAgentAsync(
string agentId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -71,25 +74,46 @@ partial void ProcessGetChatAgentResponseContent(
securityRequirements: s_GetChatAgentSecurityRequirements,
operationName: "GetChatAgentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-chat-agent/{agentId}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-chat-agent/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -99,265 +123,424 @@ partial void ProcessGetChatAgentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetChatAgentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId,
- version: version);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetChatAgentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId,
+ version: version);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetChatAgentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetChatAgentResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgent",
+ methodName: "GetChatAgentAsync",
+ pathTemplate: "$\"/get-chat-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgent",
+ methodName: "GetChatAgentAsync",
+ pathTemplate: "$\"/get-chat-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetChatAgentResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgent",
+ methodName: "GetChatAgentAsync",
+ pathTemplate: "$\"/get-chat-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetChatAgentResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetChatAgentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgent",
+ methodName: "GetChatAgentAsync",
+ pathTemplate: "$\"/get-chat-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgent",
+ methodName: "GetChatAgentAsync",
+ pathTemplate: "$\"/get-chat-agent/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetChatAgentResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetChatAgentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetChatAgentResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetChatAgentResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetChatAgentResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetChatAgentResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetChatAgentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetChatAgentResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetChatAgentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ChatAgentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatAgentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ChatAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetChatAgentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ChatAgentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ChatAgentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgentVersions.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgentVersions.g.cs
index 15bc743..82ed840 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgentVersions.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetChatAgentVersions.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,10 +47,12 @@ partial void ProcessGetChatAgentVersionsResponseContent(
///
/// Example: 16b980523634a6dc504898cda492e939
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task> GetChatAgentVersionsAsync(
string agentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetChatAgentVersionsResponseContent(
securityRequirements: s_GetChatAgentVersionsSecurityRequirements,
operationName: "GetChatAgentVersionsAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-chat-agent-versions/{agentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-chat-agent-versions/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,226 +113,385 @@ partial void ProcessGetChatAgentVersionsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetChatAgentVersionsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetChatAgentVersionsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetChatAgentVersionsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetChatAgentVersionsResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgentVersions",
+ methodName: "GetChatAgentVersionsAsync",
+ pathTemplate: "$\"/get-chat-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetChatAgentVersionsResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgentVersions",
+ methodName: "GetChatAgentVersionsAsync",
+ pathTemplate: "$\"/get-chat-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.GetChatAgentVersionsResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetChatAgentVersionsResponse2? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatAgentVersionsResponse2.FromJson(__content_422, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgentVersions",
+ methodName: "GetChatAgentVersionsAsync",
+ pathTemplate: "$\"/get-chat-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetChatAgentVersionsResponse2.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetChatAgentVersionsResponse3? __value_500 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetChatAgentVersionsResponse3.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetChatAgentVersionsResponse3.FromJson(__content_500, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetChatAgentVersionsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgentVersions",
+ methodName: "GetChatAgentVersionsAsync",
+ pathTemplate: "$\"/get-chat-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_500 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetChatAgentVersions",
+ methodName: "GetChatAgentVersionsAsync",
+ pathTemplate: "$\"/get-chat-agent-versions/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetChatAgentVersionsResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetChatAgentVersionsResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetChatAgentVersionsResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetChatAgentVersionsResponse2? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetChatAgentVersionsResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetChatAgentVersionsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetChatAgentVersionsResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetChatAgentVersionsResponse3? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatAgentVersionsResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetChatAgentVersionsResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetChatAgentVersionsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConcurrency.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConcurrency.g.cs
index fb9e16f..3bb90c2 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConcurrency.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConcurrency.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -41,9 +42,11 @@ partial void ProcessGetConcurrencyResponseContent(
///
/// Get the current concurrency and concurrency limit of the org
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetConcurrencyAsync(
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -57,22 +60,43 @@ partial void ProcessGetConcurrencyResponseContent(
securityRequirements: s_GetConcurrencySecurityRequirements,
operationName: "GetConcurrencyAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: "/get-concurrency",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: "/get-concurrency",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -82,187 +106,346 @@ partial void ProcessGetConcurrencyResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetConcurrencyRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetConcurrencyRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetConcurrencyResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetConcurrencyResponse2? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConcurrency",
+ methodName: "GetConcurrencyAsync",
+ pathTemplate: "\"/get-concurrency\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetConcurrencyResponse2.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConcurrency",
+ methodName: "GetConcurrencyAsync",
+ pathTemplate: "\"/get-concurrency\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.GetConcurrencyResponse2.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetConcurrencyResponse3? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetConcurrencyResponse3.FromJson(__content_500, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConcurrency",
+ methodName: "GetConcurrencyAsync",
+ pathTemplate: "\"/get-concurrency\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetConcurrencyResponse3.FromJson(__content_500, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetConcurrencyResponseContent(
+ response: __response);
+ ProcessGetConcurrencyResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::RetellAI.GetConcurrencyResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConcurrency",
+ methodName: "GetConcurrencyAsync",
+ pathTemplate: "\"/get-concurrency\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConcurrency",
+ methodName: "GetConcurrencyAsync",
+ pathTemplate: "\"/get-concurrency\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetConcurrencyResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetConcurrencyResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::RetellAI.GetConcurrencyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_401 = global::RetellAI.GetConcurrencyResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetConcurrencyResponse3? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetConcurrencyResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::RetellAI.GetConcurrencyResponse3.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetConcurrencyResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.GetConcurrencyResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.GetConcurrencyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlow.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlow.g.cs
index c244ae3..1776f3e 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlow.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlow.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -49,11 +50,13 @@ partial void ProcessGetConversationFlowResponseContent(
///
/// Example: 1
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetConversationFlowAsync(
string conversationFlowId,
int? version = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -69,25 +72,46 @@ partial void ProcessGetConversationFlowResponseContent(
securityRequirements: s_GetConversationFlowSecurityRequirements,
operationName: "GetConversationFlowAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-conversation-flow/{conversationFlowId}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-conversation-flow/{conversationFlowId}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -97,303 +121,462 @@ partial void ProcessGetConversationFlowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetConversationFlowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- conversationFlowId: conversationFlowId,
- version: version);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetConversationFlowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ conversationFlowId: conversationFlowId,
+ version: version);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetConversationFlowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetConversationFlowResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlow",
+ methodName: "GetConversationFlowAsync",
+ pathTemplate: "$\"/get-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlow",
+ methodName: "GetConversationFlowAsync",
+ pathTemplate: "$\"/get-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetConversationFlowResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlow",
+ methodName: "GetConversationFlowAsync",
+ pathTemplate: "$\"/get-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.GetConversationFlowResponse3? __value_404 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetConversationFlowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlow",
+ methodName: "GetConversationFlowAsync",
+ pathTemplate: "$\"/get-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlow",
+ methodName: "GetConversationFlowAsync",
+ pathTemplate: "$\"/get-conversation-flow/{conversationFlowId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetConversationFlowResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.GetConversationFlowResponse4? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetConversationFlowResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_429 = global::RetellAI.GetConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetConversationFlowResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetConversationFlowResponse5? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetConversationFlowResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.GetConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.GetConversationFlowResponse3? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.GetConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.GetConversationFlowResponse3.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.GetConversationFlowResponse4? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.GetConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetConversationFlowResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.GetConversationFlowResponse4.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetConversationFlowResponse5? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ConversationFlowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetConversationFlowResponse5.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ConversationFlowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetConversationFlowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ConversationFlowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ConversationFlowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlowComponent.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlowComponent.g.cs
index 41f0439..f0d40b7 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlowComponent.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetConversationFlowComponent.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,10 +45,12 @@ partial void ProcessGetConversationFlowComponentResponseContent(
/// Get a shared conversation flow component
///
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetConversationFlowComponentAsync(
string conversationFlowComponentId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetConversationFlowComponentResponseContent(
securityRequirements: s_GetConversationFlowComponentSecurityRequirements,
operationName: "GetConversationFlowComponentAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-conversation-flow-component/{conversationFlowComponentId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-conversation-flow-component/{conversationFlowComponentId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,264 +111,423 @@ partial void ProcessGetConversationFlowComponentResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetConversationFlowComponentRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- conversationFlowComponentId: conversationFlowComponentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetConversationFlowComponentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ conversationFlowComponentId: conversationFlowComponentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetConversationFlowComponentResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetConversationFlowComponentResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlowComponent",
+ methodName: "GetConversationFlowComponentAsync",
+ pathTemplate: "$\"/get-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlowComponent",
+ methodName: "GetConversationFlowComponentAsync",
+ pathTemplate: "$\"/get-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.GetConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::RetellAI.GetConversationFlowComponentResponse2? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlowComponent",
+ methodName: "GetConversationFlowComponentAsync",
+ pathTemplate: "$\"/get-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::RetellAI.GetConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.GetConversationFlowComponentResponse3? __value_429 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetConversationFlowComponentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlowComponent",
+ methodName: "GetConversationFlowComponentAsync",
+ pathTemplate: "$\"/get-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetConversationFlowComponent",
+ methodName: "GetConversationFlowComponentAsync",
+ pathTemplate: "$\"/get-conversation-flow-component/{conversationFlowComponentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetConversationFlowComponentResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetConversationFlowComponentResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetConversationFlowComponentResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.GetConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::RetellAI.GetConversationFlowComponentResponse2? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::RetellAI.GetConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_404 = global::RetellAI.GetConversationFlowComponentResponse2.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.GetConversationFlowComponentResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.GetConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetConversationFlowComponentResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.GetConversationFlowComponentResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetConversationFlowComponentResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.ConversationFlowComponentResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetConversationFlowComponentResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.ConversationFlowComponentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetConversationFlowComponentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.ConversationFlowComponentResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.ConversationFlowComponentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetKnowledgeBase.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetKnowledgeBase.g.cs
index abb28ba..6be0c87 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetKnowledgeBase.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetKnowledgeBase.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,10 +47,12 @@ partial void ProcessGetKnowledgeBaseResponseContent(
///
/// Example: kb_1234567890
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task GetKnowledgeBaseAsync(
string knowledgeBaseId,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetKnowledgeBaseResponseContent(
securityRequirements: s_GetKnowledgeBaseSecurityRequirements,
operationName: "GetKnowledgeBaseAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-knowledge-base/{knowledgeBaseId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-knowledge-base/{knowledgeBaseId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,264 +113,423 @@ partial void ProcessGetKnowledgeBaseResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetKnowledgeBaseRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- knowledgeBaseId: knowledgeBaseId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetKnowledgeBaseRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ knowledgeBaseId: knowledgeBaseId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetKnowledgeBaseResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unauthorized
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetKnowledgeBaseResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetKnowledgeBase",
+ methodName: "GetKnowledgeBaseAsync",
+ pathTemplate: "$\"/get-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetKnowledgeBase",
+ methodName: "GetKnowledgeBaseAsync",
+ pathTemplate: "$\"/get-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::RetellAI.GetKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetKnowledgeBaseResponse2? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetKnowledgeBase",
+ methodName: "GetKnowledgeBaseAsync",
+ pathTemplate: "$\"/get-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Too Many Requests
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::RetellAI.GetKnowledgeBaseResponse3? __value_429 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::RetellAI.GetKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetKnowledgeBaseResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetKnowledgeBase",
+ methodName: "GetKnowledgeBaseAsync",
+ pathTemplate: "$\"/get-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetKnowledgeBase",
+ methodName: "GetKnowledgeBaseAsync",
+ pathTemplate: "$\"/get-knowledge-base/{knowledgeBaseId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetKnowledgeBaseResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetKnowledgeBaseResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetKnowledgeBaseResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::RetellAI.GetKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetKnowledgeBaseResponse2? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_422 = global::RetellAI.GetKnowledgeBaseResponse2.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::RetellAI.GetKnowledgeBaseResponse3? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::RetellAI.GetKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetKnowledgeBaseResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_429 = global::RetellAI.GetKnowledgeBaseResponse3.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetKnowledgeBaseResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetKnowledgeBaseResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetKnowledgeBaseResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::RetellAI.KnowledgeBaseResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::RetellAI.KnowledgeBaseResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::RetellAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetMCPTools.g.cs b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetMCPTools.g.cs
index f512b32..a3d0d41 100644
--- a/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetMCPTools.g.cs
+++ b/src/libs/RetellAI/Generated/RetellAI.RetellAiClient.GetMCPTools.g.cs
@@ -14,6 +14,7 @@ public partial class RetellAiClient
{ new global::RetellAI.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "ApiKey",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -61,6 +62,7 @@ partial void ProcessGetMCPToolsResponseContent(
///
/// Example: component-123
///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task> GetMCPToolsAsync(
@@ -68,6 +70,7 @@ partial void ProcessGetMCPToolsResponseContent(
string mcpId,
int? version = default,
string? componentId = default,
+ global::RetellAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -85,27 +88,48 @@ partial void ProcessGetMCPToolsResponseContent(
securityRequirements: s_GetMCPToolsSecurityRequirements,
operationName: "GetMCPToolsAsync");
- var __pathBuilder = new global::RetellAI.PathBuilder(
- path: $"/get-mcp-tools/{agentId}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- .AddRequiredParameter("mcp_id", mcpId)
- .AddOptionalParameter("component_id", componentId)
- ;
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::RetellAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::RetellAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::RetellAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::RetellAI.PathBuilder(
+ path: $"/get-mcp-tools/{agentId}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ .AddRequiredParameter("mcp_id", mcpId)
+ .AddOptionalParameter("component_id", componentId)
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::RetellAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -115,267 +139,426 @@ partial void ProcessGetMCPToolsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::RetellAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetMCPToolsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- agentId: agentId,
- version: version,
- mcpId: mcpId,
- componentId: componentId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetMCPToolsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ agentId: agentId,
+ version: version,
+ mcpId: mcpId,
+ componentId: componentId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetMCPToolsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::RetellAI.GetMCPToolsResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetMCPTools",
+ methodName: "GetMCPToolsAsync",
+ pathTemplate: "$\"/get-mcp-tools/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::RetellAI.GetMCPToolsResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetMCPTools",
+ methodName: "GetMCPToolsAsync",
+ pathTemplate: "$\"/get-mcp-tools/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::RetellAI.GetMCPToolsResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::RetellAI.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::RetellAI.GetMCPToolsResponse2? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::RetellAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetMCPToolsResponse2.FromJson(__content_401, JsonSerializerContext);
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetMCPTools",
+ methodName: "GetMCPToolsAsync",
+ pathTemplate: "$\"/get-mcp-tools/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::RetellAI.GetMCPToolsResponse2.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::RetellAI.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unprocessable Content
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::RetellAI.GetMCPToolsResponse3? __value_422 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetMCPToolsResponse3.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::RetellAI.GetMCPToolsResponse3.FromJson(__content_422, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetMCPToolsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetMCPTools",
+ methodName: "GetMCPToolsAsync",
+ pathTemplate: "$\"/get-mcp-tools/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_422 = __ex;
+ await global::RetellAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::RetellAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetMCPTools",
+ methodName: "GetMCPToolsAsync",
+ pathTemplate: "$\"/get-mcp-tools/{agentId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::RetellAI.GetMCPToolsResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetMCPToolsResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::RetellAI.GetMCPToolsResponse4? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::RetellAI.GetMCPToolsResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::RetellAI.GetMCPToolsResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::RetellAI.GetMCPToolsResponse4.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::RetellAI.GetMCPToolsResponse2? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::RetellAI.GetMCPToolsResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::RetellAI.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::RetellAI.GetMCPToolsResponse2.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::RetellAI.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unprocessable Content
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::RetellAI.GetMCPToolsResponse3? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::RetellAI.GetMCPToolsResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetMCPToolsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_422 = global::RetellAI.GetMCPToolsResponse3.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::RetellAI.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::RetellAI.GetMCPToolsResponse4? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetMCPToolsResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::RetellAI.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::RetellAI.GetMCPToolsResponse4.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::RetellAI.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetMCPToolsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList