Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace Recraft
typeof(global::Recraft.JsonConverters.ResponseFormatNullableJsonConverter),
typeof(global::Recraft.JsonConverters.ImageSizeJsonConverter),
typeof(global::Recraft.JsonConverters.ImageSizeNullableJsonConverter),
typeof(global::Recraft.JsonConverters.UpscaleModeJsonConverter),
typeof(global::Recraft.JsonConverters.UpscaleModeNullableJsonConverter),
typeof(global::Recraft.JsonConverters.CreateStyleResponseJsonConverter),
typeof(global::Recraft.JsonConverters.TransformImageWithMaskRequestJsonConverter),
typeof(global::Recraft.JsonConverters.UnixTimestampJsonConverter),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial interface IImageClient
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> CreativeUpscaleAsync(
Expand All @@ -30,6 +31,7 @@ public partial interface IImageClient
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial interface IImageClient
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> CrispUpscaleAsync(
Expand All @@ -30,6 +31,7 @@ public partial interface IImageClient
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public partial interface IImageClient
/// <param name="styleId"></param>
/// <param name="substyle"></param>
/// <param name="textLayout"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Recraft.GenerateImageResponse> GenerateImageAsync(
Expand All @@ -52,6 +53,7 @@ public partial interface IImageClient
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial interface IImageClient
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> RemoveBackgroundAsync(
Expand All @@ -30,6 +31,7 @@ public partial interface IImageClient
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial interface IImageClient
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> VectorizeImageAsync(
Expand All @@ -30,6 +31,7 @@ public partial interface IImageClient
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ partial void ProcessCreativeUpscaleResponseContent(
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"),
name: "response_format");
}
if (request.Upscale != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"),
name: "upscale");
}
__httpRequest.Content = __httpRequestContent;

Expand Down Expand Up @@ -191,6 +197,7 @@ partial void ProcessCreativeUpscaleResponseContent(
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> CreativeUpscaleAsync(
Expand All @@ -199,6 +206,7 @@ partial void ProcessCreativeUpscaleResponseContent(
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Recraft.ProcessImageRequest
Expand All @@ -208,6 +216,7 @@ partial void ProcessCreativeUpscaleResponseContent(
Imagename = imagename,
ImageFormat = imageFormat,
ResponseFormat = responseFormat,
Upscale = upscale,
};

return await CreativeUpscaleAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ partial void ProcessCrispUpscaleResponseContent(
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"),
name: "response_format");
}
if (request.Upscale != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"),
name: "upscale");
}
__httpRequest.Content = __httpRequestContent;

Expand Down Expand Up @@ -191,6 +197,7 @@ partial void ProcessCrispUpscaleResponseContent(
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> CrispUpscaleAsync(
Expand All @@ -199,6 +206,7 @@ partial void ProcessCrispUpscaleResponseContent(
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Recraft.ProcessImageRequest
Expand All @@ -208,6 +216,7 @@ partial void ProcessCrispUpscaleResponseContent(
Imagename = imagename,
ImageFormat = imageFormat,
ResponseFormat = responseFormat,
Upscale = upscale,
};

return await CrispUpscaleAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ partial void ProcessGenerateImageResponseContent(
/// <param name="styleId"></param>
/// <param name="substyle"></param>
/// <param name="textLayout"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Recraft.GenerateImageResponse> GenerateImageAsync(
Expand All @@ -203,6 +204,7 @@ partial void ProcessGenerateImageResponseContent(
global::System.Guid? styleId = default,
global::Recraft.ImageSubStyle? substyle = default,
global::System.Collections.Generic.IList<global::Recraft.TextLayoutItem>? textLayout = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Recraft.GenerateImageRequest
Expand All @@ -223,6 +225,7 @@ partial void ProcessGenerateImageResponseContent(
StyleId = styleId,
Substyle = substyle,
TextLayout = textLayout,
Upscale = upscale,
};

return await GenerateImageAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ partial void ProcessRemoveBackgroundResponseContent(
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"),
name: "response_format");
}
if (request.Upscale != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"),
name: "upscale");
}
__httpRequest.Content = __httpRequestContent;

Expand Down Expand Up @@ -191,6 +197,7 @@ partial void ProcessRemoveBackgroundResponseContent(
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> RemoveBackgroundAsync(
Expand All @@ -199,6 +206,7 @@ partial void ProcessRemoveBackgroundResponseContent(
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Recraft.ProcessImageRequest
Expand All @@ -208,6 +216,7 @@ partial void ProcessRemoveBackgroundResponseContent(
Imagename = imagename,
ImageFormat = imageFormat,
ResponseFormat = responseFormat,
Upscale = upscale,
};

return await RemoveBackgroundAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ partial void ProcessVectorizeImageResponseContent(
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.ResponseFormat?.ToValueString()}"),
name: "response_format");
}
if (request.Upscale != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"{request.Upscale?.ToValueString()}"),
name: "upscale");
}
__httpRequest.Content = __httpRequestContent;

Expand Down Expand Up @@ -191,6 +197,7 @@ partial void ProcessVectorizeImageResponseContent(
/// <param name="imagename"></param>
/// <param name="imageFormat"></param>
/// <param name="responseFormat"></param>
/// <param name="upscale"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::Recraft.ProcessImageResponse> VectorizeImageAsync(
Expand All @@ -199,6 +206,7 @@ partial void ProcessVectorizeImageResponseContent(
bool? expire = default,
global::Recraft.ImageFormat? imageFormat = default,
global::Recraft.ResponseFormat? responseFormat = default,
global::Recraft.UpscaleMode? upscale = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Recraft.ProcessImageRequest
Expand All @@ -208,6 +216,7 @@ partial void ProcessVectorizeImageResponseContent(
Imagename = imagename,
ImageFormat = imageFormat,
ResponseFormat = responseFormat,
Upscale = upscale,
};

return await VectorizeImageAsync(
Expand Down
53 changes: 53 additions & 0 deletions src/libs/Recraft/Generated/Recraft.JsonConverters.UpscaleMode.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class UpscaleModeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.UpscaleMode>
{
/// <inheritdoc />
public override global::Recraft.UpscaleMode Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Recraft.UpscaleModeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Recraft.UpscaleMode)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Recraft.UpscaleMode);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Recraft.UpscaleMode value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Recraft.UpscaleModeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class UpscaleModeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.UpscaleMode?>
{
/// <inheritdoc />
public override global::Recraft.UpscaleMode? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Recraft.UpscaleModeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Recraft.UpscaleMode)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Recraft.UpscaleMode?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Recraft.UpscaleMode? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Recraft.UpscaleModeExtensions.ToValueString(value.Value));
}
}
}
}
Loading
Loading