From 36e85f06de0ea39b83b029c16e256f5abbb4267d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 03:28:37 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Recraft.ImageClient.CreativeUpscale.g.cs | 38 +++++++++-- .../Recraft.ImageClient.CrispUpscale.g.cs | 38 +++++++++-- .../Recraft.ImageClient.EraseRegion.g.cs | 64 +++++++++++++++++-- ...ecraft.ImageClient.GenerateBackground.g.cs | 2 +- .../Recraft.ImageClient.ImageToImage.g.cs | 62 +++++++++++++----- .../Recraft.ImageClient.InpaintImage.g.cs | 2 +- .../Recraft.ImageClient.RemoveBackground.g.cs | 38 +++++++++-- ...Recraft.ImageClient.ReplaceBackground.g.cs | 58 ++++++++++++----- .../Recraft.ImageClient.VariateImage.g.cs | 42 ++++++++++-- .../Recraft.ImageClient.VectorizeImage.g.cs | 2 +- .../Recraft.StyleClient.CreateStyle.g.cs | 21 +++--- .../Recraft.StyleClient.DeleteStyle.g.cs | 2 +- .../Recraft.StyleClient.GetStyle.g.cs | 2 +- 13 files changed, 298 insertions(+), 73 deletions(-) diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.CreativeUpscale.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.CreativeUpscale.g.cs index 9a68d9e..4260990 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.CreativeUpscale.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.CreativeUpscale.g.cs @@ -129,17 +129,45 @@ partial void ProcessCreativeUpscaleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -152,21 +180,21 @@ partial void ProcessCreativeUpscaleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } if (request.Upscale != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Upscale).HasValue ? (request.Upscale).GetValueOrDefault().ToValueString() : string.Empty), name: "\"upscale\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.CrispUpscale.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.CrispUpscale.g.cs index 79ef49c..d1070bd 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.CrispUpscale.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.CrispUpscale.g.cs @@ -129,17 +129,45 @@ partial void ProcessCrispUpscaleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -152,21 +180,21 @@ partial void ProcessCrispUpscaleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } if (request.Upscale != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Upscale).HasValue ? (request.Upscale).GetValueOrDefault().ToValueString() : string.Empty), name: "\"upscale\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.EraseRegion.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.EraseRegion.g.cs index 811e7f3..b536e9d 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.EraseRegion.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.EraseRegion.g.cs @@ -129,17 +129,45 @@ partial void ProcessEraseRegionResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -152,10 +180,38 @@ partial void ProcessEraseRegionResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } var __contentMask = new global::System.Net.Http.ByteArrayContent(request.Mask ?? global::System.Array.Empty()); + __contentMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Maskname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Maskname) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentMask, name: "\"mask\"", @@ -168,7 +224,7 @@ partial void ProcessEraseRegionResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.GenerateBackground.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.GenerateBackground.g.cs index af5a6b1..7de4c3c 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.GenerateBackground.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.GenerateBackground.g.cs @@ -127,7 +127,7 @@ partial void ProcessGenerateBackgroundResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.ImageToImage.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.ImageToImage.g.cs index 43b6a65..5ead9bd 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.ImageToImage.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.ImageToImage.g.cs @@ -129,38 +129,66 @@ partial void ProcessImageToImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.BlockNsfw != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.BlockNsfw}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.BlockNsfw, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"block_nsfw\""); } if (request.CalculateFeatures != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.CalculateFeatures}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.CalculateFeatures, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"calculate_features\""); } if (request.Controls != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Controls}"), + content: new global::System.Net.Http.StringContent(request.Controls.ToJson(JsonSerializerContext)), name: "\"controls\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -173,76 +201,76 @@ partial void ProcessImageToImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.Model != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Model?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Model).HasValue ? (request.Model).GetValueOrDefault().ToValueString() : string.Empty), name: "\"model\""); } if (request.N != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.N}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); } if (request.NegativePrompt != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.NegativePrompt}"), + content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); } __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Prompt}"), + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); if (request.RandomSeed != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.RandomSeed}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RandomSeed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"random_seed\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Strength}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Strength, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"strength\""); if (request.Style != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Style}"), + content: new global::System.Net.Http.StringContent(request.Style ?? string.Empty), name: "\"style\""); } if (request.StyleId != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.StyleId}"), + content: new global::System.Net.Http.StringContent(request.StyleId.ToString() ?? string.Empty), name: "\"style_id\""); } if (request.Substyle != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Substyle?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Substyle).HasValue ? (request.Substyle).GetValueOrDefault().ToValueString() : string.Empty), name: "\"substyle\""); } if (request.TextLayout != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TextLayout, x => x))}]"), + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TextLayout, x => x.ToJson(JsonSerializerContext)))}]"), name: "\"text_layout\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.InpaintImage.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.InpaintImage.g.cs index b3879d1..988d5f2 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.InpaintImage.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.InpaintImage.g.cs @@ -127,7 +127,7 @@ partial void ProcessInpaintImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.RemoveBackground.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.RemoveBackground.g.cs index 00af4b0..ef484f5 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.RemoveBackground.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.RemoveBackground.g.cs @@ -129,17 +129,45 @@ partial void ProcessRemoveBackgroundResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -152,21 +180,21 @@ partial void ProcessRemoveBackgroundResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } if (request.Upscale != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Upscale).HasValue ? (request.Upscale).GetValueOrDefault().ToValueString() : string.Empty), name: "\"upscale\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.ReplaceBackground.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.ReplaceBackground.g.cs index e304edb..ff12439 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.ReplaceBackground.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.ReplaceBackground.g.cs @@ -129,31 +129,59 @@ partial void ProcessReplaceBackgroundResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.BlockNsfw != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.BlockNsfw}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.BlockNsfw, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"block_nsfw\""); } if (request.CalculateFeatures != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.CalculateFeatures}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.CalculateFeatures, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"calculate_features\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -166,73 +194,73 @@ partial void ProcessReplaceBackgroundResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.Model != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Model?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Model).HasValue ? (request.Model).GetValueOrDefault().ToValueString() : string.Empty), name: "\"model\""); } if (request.N != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.N}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); } if (request.NegativePrompt != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.NegativePrompt}"), + content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); } __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Prompt}"), + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); if (request.RandomSeed != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.RandomSeed}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RandomSeed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"random_seed\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } if (request.Style != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Style}"), + content: new global::System.Net.Http.StringContent(request.Style ?? string.Empty), name: "\"style\""); } if (request.StyleId != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.StyleId}"), + content: new global::System.Net.Http.StringContent(request.StyleId.ToString() ?? string.Empty), name: "\"style_id\""); } if (request.Substyle != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Substyle?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Substyle).HasValue ? (request.Substyle).GetValueOrDefault().ToValueString() : string.Empty), name: "\"substyle\""); } if (request.TextLayout != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TextLayout, x => x))}]"), + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TextLayout, x => x.ToJson(JsonSerializerContext)))}]"), name: "\"text_layout\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.VariateImage.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.VariateImage.g.cs index 700286b..f2e7790 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.VariateImage.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.VariateImage.g.cs @@ -129,17 +129,45 @@ partial void ProcessVariateImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.Expire != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Expire}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Expire, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"expire\""); } var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? string.Empty).ToLowerInvariant() switch + { + ".aac" => "audio/aac", + ".flac" => "audio/flac", + ".gif" => "image/gif", + ".jpeg" => "image/jpeg", + ".jpg" => "image/jpeg", + ".json" => "application/json", + ".m4a" => "audio/mp4", + ".mp3" => "audio/mpeg", + ".mp4" => "video/mp4", + ".mpeg" => "audio/mpeg", + ".mpga" => "audio/mpeg", + ".oga" => "audio/ogg", + ".ogg" => "audio/ogg", + ".opus" => "audio/ogg", + ".pdf" => "application/pdf", + ".png" => "image/png", + ".txt" => "text/plain", + ".wav" => "audio/wav", + ".weba" => "audio/webm", + ".webm" => "video/webm", + ".webp" => "image/webp", + _ => "application/octet-stream", + }); __httpRequestContent.Add( content: __contentImage, name: "\"image\"", @@ -152,32 +180,32 @@ partial void ProcessVariateImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ImageFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ImageFormat).HasValue ? (request.ImageFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"image_format\""); } if (request.N != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.N}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); } if (request.RandomSeed != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.RandomSeed}"), + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RandomSeed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"random_seed\""); } if (request.ResponseFormat != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"response_format\""); } __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Size.ToValueString()}"), + content: new global::System.Net.Http.StringContent(request.Size.ToValueString()), name: "\"size\""); __httpRequest.Content = __httpRequestContent; global::Recraft.AutoSDKRequestOptionsSupport.ApplyHeaders( diff --git a/src/libs/Recraft/Generated/Recraft.ImageClient.VectorizeImage.g.cs b/src/libs/Recraft/Generated/Recraft.ImageClient.VectorizeImage.g.cs index e25858c..78ed531 100644 --- a/src/libs/Recraft/Generated/Recraft.ImageClient.VectorizeImage.g.cs +++ b/src/libs/Recraft/Generated/Recraft.ImageClient.VectorizeImage.g.cs @@ -127,7 +127,7 @@ partial void ProcessVectorizeImageResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } __httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Recraft/Generated/Recraft.StyleClient.CreateStyle.g.cs b/src/libs/Recraft/Generated/Recraft.StyleClient.CreateStyle.g.cs index 5e9533a..a56af5c 100644 --- a/src/libs/Recraft/Generated/Recraft.StyleClient.CreateStyle.g.cs +++ b/src/libs/Recraft/Generated/Recraft.StyleClient.CreateStyle.g.cs @@ -129,19 +129,20 @@ partial void ProcessCreateStyleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{billing?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((billing).HasValue ? (billing).GetValueOrDefault().ToValueString() : string.Empty), name: "\"billing\""); } if (request.ImageWeights != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.ImageWeights, x => x))}]"), + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.ImageWeights, x => global::System.Convert.ToString(x, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty))}]"), name: "\"image_weights\""); } for (var __iImages = 0; __iImages < request.Images.Count; __iImages++) { var __contentImages = new global::System.Net.Http.ByteArrayContent(request.Images[__iImages]); + __contentImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); __httpRequestContent.Add( content: __contentImages, name: "\"images\"", @@ -155,53 +156,53 @@ partial void ProcessCreateStyleResponseContent( { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.MixPolicy?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.MixPolicy).HasValue ? (request.MixPolicy).GetValueOrDefault().ToValueString() : string.Empty), name: "\"mix_policy\""); } if (request.Model != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Model?.ToValueString()}"), + content: new global::System.Net.Http.StringContent((request.Model).HasValue ? (request.Model).GetValueOrDefault().ToValueString() : string.Empty), name: "\"model\""); } if (request.Palette != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Palette}"), + content: new global::System.Net.Http.StringContent(request.Palette.ToJson(JsonSerializerContext)), name: "\"palette\""); } if (request.Private != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Private}"), + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Private, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"private\""); } if (request.Prompt != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Prompt}"), + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); } if (request.SourceStyleWeights != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.SourceStyleWeights, x => x))}]"), + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.SourceStyleWeights, x => global::System.Convert.ToString(x, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty))}]"), name: "\"source_style_weights\""); } if (request.SourceStyles != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.SourceStyles, x => x))}]"), + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.SourceStyles, x => x.ToString() ?? string.Empty))}]"), name: "\"source_styles\""); } __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"{request.Style.ToValueString()}"), + content: new global::System.Net.Http.StringContent(request.Style.ToValueString()), name: "\"style\""); __httpRequest.Content = __httpRequestContent; global::Recraft.AutoSDKRequestOptionsSupport.ApplyHeaders( diff --git a/src/libs/Recraft/Generated/Recraft.StyleClient.DeleteStyle.g.cs b/src/libs/Recraft/Generated/Recraft.StyleClient.DeleteStyle.g.cs index ed4bfee..cdb03ef 100644 --- a/src/libs/Recraft/Generated/Recraft.StyleClient.DeleteStyle.g.cs +++ b/src/libs/Recraft/Generated/Recraft.StyleClient.DeleteStyle.g.cs @@ -124,7 +124,7 @@ partial void ProcessDeleteStyleResponseContent( PrepareDeleteStyleRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, - styleId: styleId); + styleId: styleId!); return __httpRequest; } diff --git a/src/libs/Recraft/Generated/Recraft.StyleClient.GetStyle.g.cs b/src/libs/Recraft/Generated/Recraft.StyleClient.GetStyle.g.cs index 9cce204..68c74e3 100644 --- a/src/libs/Recraft/Generated/Recraft.StyleClient.GetStyle.g.cs +++ b/src/libs/Recraft/Generated/Recraft.StyleClient.GetStyle.g.cs @@ -124,7 +124,7 @@ partial void ProcessGetStyleResponseContent( PrepareGetStyleRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, - styleId: styleId); + styleId: styleId!); return __httpRequest; }