Skip to content

Commit

Permalink
feat: initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Nov 2, 2024
1 parent 31f953f commit 42b5259
Show file tree
Hide file tree
Showing 65 changed files with 5,432 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/helpers/FixOpenApiSpec/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@

var openApiDocument = new OpenApiStringReader().Read(yamlOrJson, out var diagnostics);

openApiDocument.Servers.Add(new OpenApiServer
{
Url = "https://external.api.recraft.ai/"
});

openApiDocument.SecurityRequirements.Add(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Id = "auth0",
Type = ReferenceType.SecurityScheme
}
},
new List<string>()
}
});
//openApiDocument.Components.Schemas["GenerateCompletionRequest"]!.Properties["stream"]!.Default = new OpenApiBoolean(true);

yamlOrJson = openApiDocument.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0);
Expand Down
49 changes: 49 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ImageSize.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageSizeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageSize>
{
/// <inheritdoc />
public override global::Recraft.ImageSize 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.ImageSizeExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::Recraft.ImageSizeExtensions.ToValueString(value));
}
}
}
56 changes: 56 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ImageSizeNullable.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageSizeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageSize?>
{
/// <inheritdoc />
public override global::Recraft.ImageSize? 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.ImageSizeExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Recraft.ImageSize? 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.ImageSizeExtensions.ToValueString(value.Value));
}
}
}
}
49 changes: 49 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ImageStyle.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageStyleJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageStyle>
{
/// <inheritdoc />
public override global::Recraft.ImageStyle 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.ImageStyleExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::Recraft.ImageStyleExtensions.ToValueString(value));
}
}
}
56 changes: 56 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ImageStyleNullable.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageStyleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageStyle?>
{
/// <inheritdoc />
public override global::Recraft.ImageStyle? 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.ImageStyleExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Recraft.ImageStyle? 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.ImageStyleExtensions.ToValueString(value.Value));
}
}
}
}
49 changes: 49 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ImageSubStyle.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageSubStyleJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageSubStyle>
{
/// <inheritdoc />
public override global::Recraft.ImageSubStyle 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.ImageSubStyleExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ImageSubStyleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ImageSubStyle?>
{
/// <inheritdoc />
public override global::Recraft.ImageSubStyle? 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.ImageSubStyleExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Recraft.ImageSubStyle? 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.ImageSubStyleExtensions.ToValueString(value.Value));
}
}
}
}
49 changes: 49 additions & 0 deletions src/libs/Recraft/Generated/JsonConverters.ResponseFormat.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

namespace Recraft.JsonConverters
{
/// <inheritdoc />
public sealed class ResponseFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Recraft.ResponseFormat>
{
/// <inheritdoc />
public override global::Recraft.ResponseFormat 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.ResponseFormatExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

writer.WriteStringValue(global::Recraft.ResponseFormatExtensions.ToValueString(value));
}
}
}
Loading

0 comments on commit 42b5259

Please sign in to comment.