From 1ad2eb2b8ada10ef55a0b21bf97b5c9fab8733d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 3 Apr 2026 05:04:53 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ...cript.ApiEndpointsClient.AgentEditJob.g.cs | 1 - ...Descript.ApiEndpointsClient.CancelJob.g.cs | 7 - .../Descript.ApiEndpointsClient.GetJob.g.cs | 1 - ...Descript.ApiEndpointsClient.GetStatus.g.cs | 1 - ...ApiEndpointsClient.ImportProjectMedia.g.cs | 1 - .../Descript.ApiEndpointsClient.ListJobs.g.cs | 1 - ...scriptClient.PostEditInDescriptSchema.g.cs | 1 - ...iptClient.GetPublishedProjectMetadata.g.cs | 1 - .../Generated/Descript.Polyfills.g.cs | 126 +++++++++++++++++- 9 files changed, 124 insertions(+), 16 deletions(-) diff --git a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.AgentEditJob.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.AgentEditJob.g.cs index 7e4b06f..75bd630 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.AgentEditJob.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.AgentEditJob.g.cs @@ -343,7 +343,6 @@ partial void ProcessAgentEditJobResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.CancelJob.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.CancelJob.g.cs index 94d98f8..df50caf 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.CancelJob.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.CancelJob.g.cs @@ -271,13 +271,6 @@ partial void ProcessCancelJobResponse( 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/Descript/Generated/Descript.ApiEndpointsClient.GetJob.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetJob.g.cs index 30a6a29..96648c9 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetJob.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetJob.g.cs @@ -284,7 +284,6 @@ partial void ProcessGetJobResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetStatus.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetStatus.g.cs index f4a0fab..fad81ff 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetStatus.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.GetStatus.g.cs @@ -168,7 +168,6 @@ partial void ProcessGetStatusResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ImportProjectMedia.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ImportProjectMedia.g.cs index 7e70118..32bb9a3 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ImportProjectMedia.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ImportProjectMedia.g.cs @@ -384,7 +384,6 @@ partial void ProcessImportProjectMediaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ListJobs.g.cs b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ListJobs.g.cs index 20dd5b0..9519e0c 100644 --- a/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ListJobs.g.cs +++ b/src/libs/Descript/Generated/Descript.ApiEndpointsClient.ListJobs.g.cs @@ -254,7 +254,6 @@ partial void ProcessListJobsResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.EditInDescriptClient.PostEditInDescriptSchema.g.cs b/src/libs/Descript/Generated/Descript.EditInDescriptClient.PostEditInDescriptSchema.g.cs index d7322b1..9340e84 100644 --- a/src/libs/Descript/Generated/Descript.EditInDescriptClient.PostEditInDescriptSchema.g.cs +++ b/src/libs/Descript/Generated/Descript.EditInDescriptClient.PostEditInDescriptSchema.g.cs @@ -278,7 +278,6 @@ partial void ProcessPostEditInDescriptSchemaResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.ExportFromDescriptClient.GetPublishedProjectMetadata.g.cs b/src/libs/Descript/Generated/Descript.ExportFromDescriptClient.GetPublishedProjectMetadata.g.cs index 80d8f95..a3ee478 100644 --- a/src/libs/Descript/Generated/Descript.ExportFromDescriptClient.GetPublishedProjectMetadata.g.cs +++ b/src/libs/Descript/Generated/Descript.ExportFromDescriptClient.GetPublishedProjectMetadata.g.cs @@ -324,7 +324,6 @@ partial void ProcessGetPublishedProjectMetadataResponseContent( try { __response.EnsureSuccessStatusCode(); - using var __content = await __response.Content.ReadAsStreamAsync( #if NET5_0_OR_GREATER cancellationToken diff --git a/src/libs/Descript/Generated/Descript.Polyfills.g.cs b/src/libs/Descript/Generated/Descript.Polyfills.g.cs index 156f96a..773fb40 100644 --- a/src/libs/Descript/Generated/Descript.Polyfills.g.cs +++ b/src/libs/Descript/Generated/Descript.Polyfills.g.cs @@ -1,5 +1,4 @@ -#if !NET6_0_OR_GREATER #nullable enable namespace Descript @@ -9,6 +8,7 @@ namespace Descript /// 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