diff --git a/src/libs/Tavus/Generated/Tavus.ConversationsClient.CreateConversation.g.cs b/src/libs/Tavus/Generated/Tavus.ConversationsClient.CreateConversation.g.cs index d9de09e..ccc0061 100644 --- a/src/libs/Tavus/Generated/Tavus.ConversationsClient.CreateConversation.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ConversationsClient.CreateConversation.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreateConversationResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ConversationsClient.DeleteConversation.g.cs b/src/libs/Tavus/Generated/Tavus.ConversationsClient.DeleteConversation.g.cs index d7ebc82..eb3be9d 100644 --- a/src/libs/Tavus/Generated/Tavus.ConversationsClient.DeleteConversation.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ConversationsClient.DeleteConversation.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteConversationResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.ConversationsClient.EndConversation.g.cs b/src/libs/Tavus/Generated/Tavus.ConversationsClient.EndConversation.g.cs index 8d5ceae..159c349 100644 --- a/src/libs/Tavus/Generated/Tavus.ConversationsClient.EndConversation.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ConversationsClient.EndConversation.g.cs @@ -119,13 +119,6 @@ partial void ProcessEndConversationResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.ConversationsClient.GetConversation.g.cs b/src/libs/Tavus/Generated/Tavus.ConversationsClient.GetConversation.g.cs index c8178f3..d3b41c4 100644 --- a/src/libs/Tavus/Generated/Tavus.ConversationsClient.GetConversation.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ConversationsClient.GetConversation.g.cs @@ -140,7 +140,6 @@ partial void ProcessGetConversationResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ConversationsClient.ListConversations.g.cs b/src/libs/Tavus/Generated/Tavus.ConversationsClient.ListConversations.g.cs index 73a314d..8af0c48 100644 --- a/src/libs/Tavus/Generated/Tavus.ConversationsClient.ListConversations.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ConversationsClient.ListConversations.g.cs @@ -125,7 +125,6 @@ partial void ProcessListConversationsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.CreateDocument.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.CreateDocument.g.cs index 3b2ee5a..5989e0b 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.CreateDocument.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.CreateDocument.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreateDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.DeleteDocument.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.DeleteDocument.g.cs index c7ab91c..e210d06 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.DeleteDocument.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.DeleteDocument.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteDocumentResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.GetDocument.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.GetDocument.g.cs index 6328133..14ebc31 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.GetDocument.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.GetDocument.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.ListDocuments.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.ListDocuments.g.cs index ba74f1e..fd1761b 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.ListDocuments.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.ListDocuments.g.cs @@ -148,7 +148,6 @@ partial void ProcessListDocumentsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.RecrawlDocument.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.RecrawlDocument.g.cs index 8b13997..28629a9 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.RecrawlDocument.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.RecrawlDocument.g.cs @@ -146,7 +146,6 @@ partial void ProcessRecrawlDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.DocumentsClient.UpdateDocument.g.cs b/src/libs/Tavus/Generated/Tavus.DocumentsClient.UpdateDocument.g.cs index d6b79ae..51bf227 100644 --- a/src/libs/Tavus/Generated/Tavus.DocumentsClient.UpdateDocument.g.cs +++ b/src/libs/Tavus/Generated/Tavus.DocumentsClient.UpdateDocument.g.cs @@ -146,7 +146,6 @@ partial void ProcessUpdateDocumentResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.CreateGuardrails.g.cs b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.CreateGuardrails.g.cs index 3e15263..2877e74 100644 --- a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.CreateGuardrails.g.cs +++ b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.CreateGuardrails.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreateGuardrailsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.DeleteGuardrails.g.cs b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.DeleteGuardrails.g.cs index bbc3a50..006591f 100644 --- a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.DeleteGuardrails.g.cs +++ b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.DeleteGuardrails.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteGuardrailsResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.GetGuardrails.g.cs b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.GetGuardrails.g.cs index 682b6e5..1ab59be 100644 --- a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.GetGuardrails.g.cs +++ b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.GetGuardrails.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetGuardrailsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.ListGuardrails.g.cs b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.ListGuardrails.g.cs index 23db16f..8a5dee3 100644 --- a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.ListGuardrails.g.cs +++ b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.ListGuardrails.g.cs @@ -125,7 +125,6 @@ partial void ProcessListGuardrailsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.PatchGuardrails.g.cs b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.PatchGuardrails.g.cs index fbbf3ba..c33c959 100644 --- a/src/libs/Tavus/Generated/Tavus.GuardrailsClient.PatchGuardrails.g.cs +++ b/src/libs/Tavus/Generated/Tavus.GuardrailsClient.PatchGuardrails.g.cs @@ -146,7 +146,6 @@ partial void ProcessPatchGuardrailsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.MemoriesClient.DeleteMemory.g.cs b/src/libs/Tavus/Generated/Tavus.MemoriesClient.DeleteMemory.g.cs index 4c0f2e0..a3f8964 100644 --- a/src/libs/Tavus/Generated/Tavus.MemoriesClient.DeleteMemory.g.cs +++ b/src/libs/Tavus/Generated/Tavus.MemoriesClient.DeleteMemory.g.cs @@ -125,13 +125,6 @@ partial void ProcessDeleteMemoryResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.CreateObjectives.g.cs b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.CreateObjectives.g.cs index 3cff259..f81f0f7 100644 --- a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.CreateObjectives.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.CreateObjectives.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreateObjectivesResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.DeleteObjectives.g.cs b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.DeleteObjectives.g.cs index 56c40f3..5157c7b 100644 --- a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.DeleteObjectives.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.DeleteObjectives.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteObjectivesResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.GetObjectives.g.cs b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.GetObjectives.g.cs index 935784c..a4db2e3 100644 --- a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.GetObjectives.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.GetObjectives.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetObjectivesResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.ListObjectives.g.cs b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.ListObjectives.g.cs index 10f27b2..3f275ee 100644 --- a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.ListObjectives.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.ListObjectives.g.cs @@ -125,7 +125,6 @@ partial void ProcessListObjectivesResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.PatchObjectives.g.cs b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.PatchObjectives.g.cs index d1e6878..7b6cf4f 100644 --- a/src/libs/Tavus/Generated/Tavus.ObjectivesClient.PatchObjectives.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ObjectivesClient.PatchObjectives.g.cs @@ -146,7 +146,6 @@ partial void ProcessPatchObjectivesResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.PersonasClient.CreatePersona.g.cs b/src/libs/Tavus/Generated/Tavus.PersonasClient.CreatePersona.g.cs index 5966efe..1a7a15e 100644 --- a/src/libs/Tavus/Generated/Tavus.PersonasClient.CreatePersona.g.cs +++ b/src/libs/Tavus/Generated/Tavus.PersonasClient.CreatePersona.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreatePersonaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.PersonasClient.DeletePersona.g.cs b/src/libs/Tavus/Generated/Tavus.PersonasClient.DeletePersona.g.cs index 4ffd5dc..ed45ea0 100644 --- a/src/libs/Tavus/Generated/Tavus.PersonasClient.DeletePersona.g.cs +++ b/src/libs/Tavus/Generated/Tavus.PersonasClient.DeletePersona.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeletePersonaResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.PersonasClient.GetPersona.g.cs b/src/libs/Tavus/Generated/Tavus.PersonasClient.GetPersona.g.cs index b567c2a..15eba67 100644 --- a/src/libs/Tavus/Generated/Tavus.PersonasClient.GetPersona.g.cs +++ b/src/libs/Tavus/Generated/Tavus.PersonasClient.GetPersona.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetPersonaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.PersonasClient.ListPersonas.g.cs b/src/libs/Tavus/Generated/Tavus.PersonasClient.ListPersonas.g.cs index 25185b5..db4f357 100644 --- a/src/libs/Tavus/Generated/Tavus.PersonasClient.ListPersonas.g.cs +++ b/src/libs/Tavus/Generated/Tavus.PersonasClient.ListPersonas.g.cs @@ -125,7 +125,6 @@ partial void ProcessListPersonasResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.PersonasClient.PatchPersona.g.cs b/src/libs/Tavus/Generated/Tavus.PersonasClient.PatchPersona.g.cs index 15565d8..035bd20 100644 --- a/src/libs/Tavus/Generated/Tavus.PersonasClient.PatchPersona.g.cs +++ b/src/libs/Tavus/Generated/Tavus.PersonasClient.PatchPersona.g.cs @@ -146,7 +146,6 @@ partial void ProcessPatchPersonaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.Polyfills.g.cs b/src/libs/Tavus/Generated/Tavus.Polyfills.g.cs index 0467980..be55995 100644 --- a/src/libs/Tavus/Generated/Tavus.Polyfills.g.cs +++ b/src/libs/Tavus/Generated/Tavus.Polyfills.g.cs @@ -1,5 +1,4 @@ -#if !NET6_0_OR_GREATER #nullable enable namespace Tavus @@ -9,6 +8,7 @@ namespace Tavus /// public static partial class AutoSdkPolyfills { +#if !NET6_0_OR_GREATER /// /// /// @@ -48,6 +48,128 @@ public static partial class AutoSdkPolyfills content = content ?? throw new global::System.ArgumentNullException(nameof(content)); return content.ReadAsByteArrayAsync(); } +#endif + + /// + /// Creates a JSON request content instance. + /// + public static global::System.Net.Http.HttpContent CreateJsonContent( + T inputValue, + string mediaType, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions) + { + if (string.IsNullOrWhiteSpace(mediaType)) + { + throw new global::System.ArgumentException("Media type is required.", nameof(mediaType)); + } + +#if NET5_0_OR_GREATER + return global::System.Net.Http.Json.JsonContent.Create( + inputValue: inputValue, + mediaType: new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType), + options: jsonSerializerOptions); +#else + var json = global::System.Text.Json.JsonSerializer.Serialize(inputValue, jsonSerializerOptions); + var stringContent = new global::System.Net.Http.StringContent( + content: json, + encoding: global::System.Text.Encoding.UTF8); + stringContent.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType) + { + CharSet = global::System.Text.Encoding.UTF8.WebName, + }; + return stringContent; +#endif + } + + /// + /// Creates a JSON request content instance using a source-generated serializer context. + /// + public static global::System.Net.Http.HttpContent CreateJsonContent( + object? inputValue, + global::System.Type inputType, + string mediaType, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + inputType = inputType ?? throw new global::System.ArgumentNullException(nameof(inputType)); + jsonSerializerContext = jsonSerializerContext ?? throw new global::System.ArgumentNullException(nameof(jsonSerializerContext)); + + if (string.IsNullOrWhiteSpace(mediaType)) + { + throw new global::System.ArgumentException("Media type is required.", nameof(mediaType)); + } + +#if NET5_0_OR_GREATER + var jsonTypeInfo = jsonSerializerContext.GetTypeInfo(inputType) ?? + throw new global::System.InvalidOperationException($"No JsonTypeInfo registered for '{inputType}'."); + return global::System.Net.Http.Json.JsonContent.Create( + inputValue: inputValue, + jsonTypeInfo: jsonTypeInfo, + mediaType: new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType)); +#else + var json = global::System.Text.Json.JsonSerializer.Serialize( + value: inputValue, + inputType: inputType, + jsonSerializerContext); + var stringContent = new global::System.Net.Http.StringContent( + content: json, + encoding: global::System.Text.Encoding.UTF8); + stringContent.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType) + { + CharSet = global::System.Text.Encoding.UTF8.WebName, + }; + return stringContent; +#endif + } + + /// + /// Reads JSON content into the specified type using serializer options. + /// + public static async global::System.Threading.Tasks.Task ReadFromJsonAsync( + this global::System.Net.Http.HttpContent content, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions, + global::System.Threading.CancellationToken cancellationToken) + { + content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + +#if NET5_0_OR_GREATER + return await global::System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync( + content, + jsonSerializerOptions, + cancellationToken).ConfigureAwait(false); +#else + using var stream = await AutoSdkPolyfills.ReadAsStreamAsync(content, cancellationToken).ConfigureAwait(false); + return await global::System.Text.Json.JsonSerializer.DeserializeAsync( + utf8Json: stream, + options: jsonSerializerOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); +#endif + } + + /// + /// Reads JSON content into the specified type using a source-generated serializer context. + /// + public static async global::System.Threading.Tasks.Task ReadFromJsonAsync( + this global::System.Net.Http.HttpContent content, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext, + global::System.Threading.CancellationToken cancellationToken) + { + content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + jsonSerializerContext = jsonSerializerContext ?? throw new global::System.ArgumentNullException(nameof(jsonSerializerContext)); + +#if NET5_0_OR_GREATER + return (T?)await global::System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync( + content, + typeof(T), + jsonSerializerContext, + cancellationToken).ConfigureAwait(false); +#else + using var stream = await AutoSdkPolyfills.ReadAsStreamAsync(content, cancellationToken).ConfigureAwait(false); + return (T?)await global::System.Text.Json.JsonSerializer.DeserializeAsync( + utf8Json: stream, + returnType: typeof(T), + jsonSerializerContext, + cancellationToken: cancellationToken).ConfigureAwait(false); +#endif + } } } -#endif \ No newline at end of file diff --git a/src/libs/Tavus/Generated/Tavus.ReplicasClient.CreateReplica.g.cs b/src/libs/Tavus/Generated/Tavus.ReplicasClient.CreateReplica.g.cs index 1a74f00..f25885e 100644 --- a/src/libs/Tavus/Generated/Tavus.ReplicasClient.CreateReplica.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ReplicasClient.CreateReplica.g.cs @@ -140,7 +140,6 @@ partial void ProcessCreateReplicaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ReplicasClient.DeleteReplica.g.cs b/src/libs/Tavus/Generated/Tavus.ReplicasClient.DeleteReplica.g.cs index ef33b4f..ecaa533 100644 --- a/src/libs/Tavus/Generated/Tavus.ReplicasClient.DeleteReplica.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ReplicasClient.DeleteReplica.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteReplicaResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.ReplicasClient.GetReplica.g.cs b/src/libs/Tavus/Generated/Tavus.ReplicasClient.GetReplica.g.cs index bbe647b..324d5ce 100644 --- a/src/libs/Tavus/Generated/Tavus.ReplicasClient.GetReplica.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ReplicasClient.GetReplica.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetReplicaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ReplicasClient.ListReplicas.g.cs b/src/libs/Tavus/Generated/Tavus.ReplicasClient.ListReplicas.g.cs index d98080a..01efbe5 100644 --- a/src/libs/Tavus/Generated/Tavus.ReplicasClient.ListReplicas.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ReplicasClient.ListReplicas.g.cs @@ -125,7 +125,6 @@ partial void ProcessListReplicasResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.ReplicasClient.RenameReplica.g.cs b/src/libs/Tavus/Generated/Tavus.ReplicasClient.RenameReplica.g.cs index a749bf6..5b89925 100644 --- a/src/libs/Tavus/Generated/Tavus.ReplicasClient.RenameReplica.g.cs +++ b/src/libs/Tavus/Generated/Tavus.ReplicasClient.RenameReplica.g.cs @@ -146,7 +146,6 @@ partial void ProcessRenameReplicaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.VideosClient.DeleteVideo.g.cs b/src/libs/Tavus/Generated/Tavus.VideosClient.DeleteVideo.g.cs index 5cab031..e6d5816 100644 --- a/src/libs/Tavus/Generated/Tavus.VideosClient.DeleteVideo.g.cs +++ b/src/libs/Tavus/Generated/Tavus.VideosClient.DeleteVideo.g.cs @@ -119,13 +119,6 @@ partial void ProcessDeleteVideoResponse( try { __response.EnsureSuccessStatusCode(); - - using var __content = await __response.Content.ReadAsStreamAsync( -#if NET5_0_OR_GREATER - cancellationToken -#endif - ).ConfigureAwait(false); - } catch (global::System.Exception __ex) { diff --git a/src/libs/Tavus/Generated/Tavus.VideosClient.GenerateVideo.g.cs b/src/libs/Tavus/Generated/Tavus.VideosClient.GenerateVideo.g.cs index 217358b..0c74dea 100644 --- a/src/libs/Tavus/Generated/Tavus.VideosClient.GenerateVideo.g.cs +++ b/src/libs/Tavus/Generated/Tavus.VideosClient.GenerateVideo.g.cs @@ -140,7 +140,6 @@ partial void ProcessGenerateVideoResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.VideosClient.GetVideo.g.cs b/src/libs/Tavus/Generated/Tavus.VideosClient.GetVideo.g.cs index 81886a8..d1dc2a4 100644 --- a/src/libs/Tavus/Generated/Tavus.VideosClient.GetVideo.g.cs +++ b/src/libs/Tavus/Generated/Tavus.VideosClient.GetVideo.g.cs @@ -131,7 +131,6 @@ partial void ProcessGetVideoResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.VideosClient.ListVideos.g.cs b/src/libs/Tavus/Generated/Tavus.VideosClient.ListVideos.g.cs index 8b91116..9c7fa0d 100644 --- a/src/libs/Tavus/Generated/Tavus.VideosClient.ListVideos.g.cs +++ b/src/libs/Tavus/Generated/Tavus.VideosClient.ListVideos.g.cs @@ -125,7 +125,6 @@ partial void ProcessListVideosResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Tavus/Generated/Tavus.VideosClient.RenameVideo.g.cs b/src/libs/Tavus/Generated/Tavus.VideosClient.RenameVideo.g.cs index 95bcbf4..a2707cf 100644 --- a/src/libs/Tavus/Generated/Tavus.VideosClient.RenameVideo.g.cs +++ b/src/libs/Tavus/Generated/Tavus.VideosClient.RenameVideo.g.cs @@ -146,7 +146,6 @@ partial void ProcessRenameVideoResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken