diff --git a/src/libs/Sightengine/Generated/Sightengine.Polyfills.g.cs b/src/libs/Sightengine/Generated/Sightengine.Polyfills.g.cs
index 02ffe56..a0d042d 100644
--- a/src/libs/Sightengine/Generated/Sightengine.Polyfills.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.Polyfills.g.cs
@@ -1,5 +1,4 @@
-#if !NET6_0_OR_GREATER
#nullable enable
namespace Sightengine
@@ -9,6 +8,7 @@ namespace Sightengine
///
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/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUpload.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUpload.g.cs
index 421dd78..b52fc40 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUpload.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUpload.g.cs
@@ -227,7 +227,6 @@ partial void ProcessCheckImageByUploadResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUrl.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUrl.g.cs
index de6a4f8..5c41d1e 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUrl.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckImageByUrl.g.cs
@@ -220,7 +220,6 @@ partial void ProcessCheckImageByUrlResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckText.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckText.g.cs
index 323dfa0..00b87c7 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckText.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckText.g.cs
@@ -219,7 +219,6 @@ partial void ProcessCheckTextResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoAsync.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoAsync.g.cs
index 01626b4..efc8ec5 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoAsync.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoAsync.g.cs
@@ -245,7 +245,6 @@ partial void ProcessCheckVideoAsyncResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoSync.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoSync.g.cs
index ad6d36f..ad4adea 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoSync.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckVideoSync.g.cs
@@ -236,7 +236,6 @@ partial void ProcessCheckVideoSyncResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUpload.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUpload.g.cs
index fd9e276..651294b 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUpload.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUpload.g.cs
@@ -225,7 +225,6 @@ partial void ProcessCheckWorkflowByUploadResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUrl.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUrl.g.cs
index d074b99..5533bb7 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUrl.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.CheckWorkflowByUrl.g.cs
@@ -218,7 +218,6 @@ partial void ProcessCheckWorkflowByUrlResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
diff --git a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.SubmitFeedback.g.cs b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.SubmitFeedback.g.cs
index 4084bdf..b07e6d5 100644
--- a/src/libs/Sightengine/Generated/Sightengine.SightengineClient.SubmitFeedback.g.cs
+++ b/src/libs/Sightengine/Generated/Sightengine.SightengineClient.SubmitFeedback.g.cs
@@ -240,7 +240,6 @@ partial void ProcessSubmitFeedbackResponseContent(
try
{
__response.EnsureSuccessStatusCode();
-
using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken