Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 21, 2024
1 parent 95f8105 commit d24bd65
Show file tree
Hide file tree
Showing 12 changed files with 666 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

#nullable enable

namespace Ideogram
{
/// <summary>
/// A member of a color palette.
/// </summary>
public sealed partial class ColorPaletteMember
{
/// <summary>
/// The hexadecimal representation of the color with an optional chosen weight<br/>
/// Example: #FFFFFF
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("color_hex")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string ColorHex { get; set; }

/// <summary>
/// The weight of the color in the color palette.<br/>
/// Example: 0.25
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("color_weight")]
[global::System.Text.Json.Serialization.JsonRequired]
public required double ColorWeight { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

#nullable enable

namespace Ideogram
{
/// <summary>
/// A color palette preset value<br/>
/// Example: PASTEL
/// </summary>
public enum ColorPalettePresetName
{
/// <summary>
///
/// </summary>
EMBER,
/// <summary>
///
/// </summary>
FRESH,
/// <summary>
///
/// </summary>
JUNGLE,
/// <summary>
///
/// </summary>
MAGIC,
/// <summary>
///
/// </summary>
MELON,
/// <summary>
///
/// </summary>
MOSAIC,
/// <summary>
///
/// </summary>
PASTEL,
/// <summary>
///
/// </summary>
ULTRAMARINE,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class ColorPalettePresetNameExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this ColorPalettePresetName value)
{
return value switch
{
ColorPalettePresetName.EMBER => "EMBER",
ColorPalettePresetName.FRESH => "FRESH",
ColorPalettePresetName.JUNGLE => "JUNGLE",
ColorPalettePresetName.MAGIC => "MAGIC",
ColorPalettePresetName.MELON => "MELON",
ColorPalettePresetName.MOSAIC => "MOSAIC",
ColorPalettePresetName.PASTEL => "PASTEL",
ColorPalettePresetName.ULTRAMARINE => "ULTRAMARINE",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static ColorPalettePresetName? ToEnum(string value)
{
return value switch
{
"EMBER" => ColorPalettePresetName.EMBER,
"FRESH" => ColorPalettePresetName.FRESH,
"JUNGLE" => ColorPalettePresetName.JUNGLE,
"MAGIC" => ColorPalettePresetName.MAGIC,
"MELON" => ColorPalettePresetName.MELON,
"MOSAIC" => ColorPalettePresetName.MOSAIC,
"PASTEL" => ColorPalettePresetName.PASTEL,
"ULTRAMARINE" => ColorPalettePresetName.ULTRAMARINE,
_ => null,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#nullable enable

namespace Ideogram
{
/// <summary>
/// A color palette represented only via its members
/// </summary>
public sealed partial class ColorPaletteWithMembers
{
/// <summary>
/// A list of ColorPaletteMembers that define the color palette.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("members")]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::System.Collections.Generic.IList<global::Ideogram.ColorPaletteMember> Members { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

#nullable enable

namespace Ideogram
{
/// <summary>
///
/// </summary>
public sealed partial class ColorPaletteWithPresetName
{
/// <summary>
/// A color palette preset value<br/>
/// Example: PASTEL
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("name")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ColorPalettePresetNameJsonConverter))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::Ideogram.ColorPalettePresetName Name { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
using System.Linq;
#pragma warning disable CS0618 // Type or member is obsolete

#nullable enable

namespace Ideogram
{
/// <summary>
/// A color palette for generation, must EITHER be specified via one of the presets (name) or explicitly via hexadecimal representations of the color with optional weights (members).
/// </summary>
public readonly partial struct ColorPaletteWithPresetNameOrMembers : global::System.IEquatable<ColorPaletteWithPresetNameOrMembers>
{
/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
public global::Ideogram.ColorPaletteWithPresetName? { get; init; }
#else
public global::Ideogram.ColorPaletteWithPresetName? { get; }
#endif

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof())]
#endif
public bool Is => != null;

/// <summary>
///
/// </summary>
public static implicit operator ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithPresetName value) => new ColorPaletteWithPresetNameOrMembers(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Ideogram.ColorPaletteWithPresetName?(ColorPaletteWithPresetNameOrMembers @this) => @this.;

/// <summary>
///
/// </summary>
public ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithPresetName? value)
{
= value;
}

/// <summary>
/// A color palette represented only via its members
/// </summary>
#if NET6_0_OR_GREATER
public global::Ideogram.ColorPaletteWithMembers? { get; init; }
#else
public global::Ideogram.ColorPaletteWithMembers? { get; }
#endif

/// <summary>
///
/// </summary>
#if NET6_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof())]
#endif
public bool Is => != null;

/// <summary>
///
/// </summary>
public static implicit operator ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithMembers value) => new ColorPaletteWithPresetNameOrMembers(value);

/// <summary>
///
/// </summary>
public static implicit operator global::Ideogram.ColorPaletteWithMembers?(ColorPaletteWithPresetNameOrMembers @this) => @this.;

/// <summary>
///
/// </summary>
public ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithMembers? value)
{
= value;
}

/// <summary>
///
/// </summary>
public ColorPaletteWithPresetNameOrMembers(
global::Ideogram.ColorPaletteWithPresetName? ,
global::Ideogram.ColorPaletteWithMembers?
)
{
= ;
= ;
}

/// <summary>
///
/// </summary>
public object? Object =>
as object ??
as object
;

/// <summary>
///
/// </summary>
public bool Validate()
{
return Is && !Is || !Is && Is;
}

/// <summary>
///
/// </summary>
public override int GetHashCode()
{
var fields = new object?[]
{
,
typeof(global::Ideogram.ColorPaletteWithPresetName),
,
typeof(global::Ideogram.ColorPaletteWithMembers),
};
const int offset = unchecked((int)2166136261);
const int prime = 16777619;
static int HashCodeAggregator(int hashCode, object? value) => value == null
? (hashCode ^ 0) * prime
: (hashCode ^ value.GetHashCode()) * prime;
return fields.Aggregate(offset, HashCodeAggregator);
}

/// <summary>
///
/// </summary>
public bool Equals(ColorPaletteWithPresetNameOrMembers other)
{
return
global::System.Collections.Generic.EqualityComparer<global::Ideogram.ColorPaletteWithPresetName?>.Default.Equals(, other.) &&
global::System.Collections.Generic.EqualityComparer<global::Ideogram.ColorPaletteWithMembers?>.Default.Equals(, other.)
;
}

/// <summary>
///
/// </summary>
public static bool operator ==(ColorPaletteWithPresetNameOrMembers obj1, ColorPaletteWithPresetNameOrMembers obj2)
{
return global::System.Collections.Generic.EqualityComparer<ColorPaletteWithPresetNameOrMembers>.Default.Equals(obj1, obj2);
}

/// <summary>
///
/// </summary>
public static bool operator !=(ColorPaletteWithPresetNameOrMembers obj1, ColorPaletteWithPresetNameOrMembers obj2)
{
return !(obj1 == obj2);
}

/// <summary>
///
/// </summary>
public override bool Equals(object? obj)
{
return obj is ColorPaletteWithPresetNameOrMembers o && Equals(o);
}
}
}
7 changes: 7 additions & 0 deletions src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public sealed partial class ImageRequest
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionJsonConverter))]
public global::Ideogram.Resolution? Resolution { get; set; }

/// <summary>
/// A color palette for generation, must EITHER be specified via one of the presets (name) or explicitly via hexadecimal representations of the color with optional weights (members).
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("color_palette")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembersJsonConverter))]
public global::Ideogram.ColorPaletteWithPresetNameOrMembers? ColorPalette { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand Down
Loading

0 comments on commit d24bd65

Please sign in to comment.