diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs new file mode 100644 index 0000000..ce55ecc --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs @@ -0,0 +1,29 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Add credits to an API user's account. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + global::Ideogram.PostAddCreditsRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Add credits to an API user's account. + /// + /// + /// Represents a price. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + global::Ideogram.Price amount, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs new file mode 100644 index 0000000..0a2f74b --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs @@ -0,0 +1,266 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + partial void PreparePostAddCreditsForApiArguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.PostAddCreditsRequest request); + partial void PreparePostAddCreditsForApiRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.PostAddCreditsRequest request); + partial void ProcessPostAddCreditsForApiResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostAddCreditsForApiResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Add credits to an API user's account. + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + global::Ideogram.PostAddCreditsRequest request, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostAddCreditsForApiArguments( + httpClient: HttpClient, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/manage/api/add_credits", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in Authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostAddCreditsForApiRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostAddCreditsForApiResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Bad request + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::Ideogram.PostAddCreditsError? __value_400 = null; + if (ReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_400 = global::Ideogram.PostAddCreditsError.FromJson(__content_400, JsonSerializerContext); + } + else + { + var __contentStream_400 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_400 = await global::Ideogram.PostAddCreditsError.FromJsonStreamAsync(__contentStream_400, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::Ideogram.ApiException( + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_400, + ResponseObject = __value_400, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + if (ReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_401 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } + + throw new global::Ideogram.ApiException( + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_401, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + if (ReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + } + else + { + var __contentStream_403 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + } + + throw new global::Ideogram.ApiException( + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_403, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostAddCreditsForApiResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ideogram.ApiException( + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseBody = __content, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + return + global::Ideogram.PostAddCreditsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ideogram.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + using var __content = await __response.Content.ReadAsStreamAsync( +#if NET5_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); + + return + await global::Ideogram.PostAddCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Add credits to an API user's account. + /// + /// + /// Represents a price. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + global::Ideogram.Price amount, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.PostAddCreditsRequest + { + Amount = amount, + }; + + return await PostAddCreditsForApiAsync( + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.Json.g.cs new file mode 100644 index 0000000..d960d7a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class PostAddCreditsError + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Ideogram.PostAddCreditsError? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PostAddCreditsError), + jsonSerializerContext) as global::Ideogram.PostAddCreditsError; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Ideogram.PostAddCreditsError? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Ideogram.PostAddCreditsError), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PostAddCreditsError; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs new file mode 100644 index 0000000..b5c0bdb --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Represents an error when attempting to add credits to an API user's account. + /// + public sealed partial class PostAddCreditsError + { + /// + /// Error messages about what the error could be. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("messages")] + public global::System.Collections.Generic.IList? Messages { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Error messages about what the error could be. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PostAddCreditsError( + global::System.Collections.Generic.IList? messages) + { + this.Messages = messages; + } + + /// + /// Initializes a new instance of the class. + /// + public PostAddCreditsError() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.Json.g.cs new file mode 100644 index 0000000..dc2b2c8 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class PostAddCreditsRequest + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Ideogram.PostAddCreditsRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PostAddCreditsRequest), + jsonSerializerContext) as global::Ideogram.PostAddCreditsRequest; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Ideogram.PostAddCreditsRequest? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Ideogram.PostAddCreditsRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PostAddCreditsRequest; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs new file mode 100644 index 0000000..3f41324 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class PostAddCreditsRequest + { + /// + /// Represents a price. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("amount")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price Amount { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Represents a price. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PostAddCreditsRequest( + global::Ideogram.Price amount) + { + this.Amount = amount ?? throw new global::System.ArgumentNullException(nameof(amount)); + } + + /// + /// Initializes a new instance of the class. + /// + public PostAddCreditsRequest() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.Json.g.cs new file mode 100644 index 0000000..4fa7378 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class PostAddCreditsResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Ideogram.PostAddCreditsResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PostAddCreditsResponse), + jsonSerializerContext) as global::Ideogram.PostAddCreditsResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Ideogram.PostAddCreditsResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Ideogram.PostAddCreditsResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PostAddCreditsResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs new file mode 100644 index 0000000..9a81184 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class PostAddCreditsResponse + { + /// + /// Represents a price. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("amount")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price Amount { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Represents a price. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PostAddCreditsResponse( + global::Ideogram.Price amount) + { + this.Amount = amount ?? throw new global::System.ArgumentNullException(nameof(amount)); + } + + /// + /// Initializes a new instance of the class. + /// + public PostAddCreditsResponse() + { + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/JsonSerializerContextTypes.g.cs b/src/libs/Ideogram/Generated/JsonSerializerContextTypes.g.cs index e48c6f0..338a5e6 100644 --- a/src/libs/Ideogram/Generated/JsonSerializerContextTypes.g.cs +++ b/src/libs/Ideogram/Generated/JsonSerializerContextTypes.g.cs @@ -306,6 +306,18 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Ideogram.PostInternalTesting200Response? Type70 { get; set; } + public global::Ideogram.PostAddCreditsResponse? Type70 { get; set; } + /// + /// + /// + public global::Ideogram.PostAddCreditsError? Type71 { get; set; } + /// + /// + /// + public global::Ideogram.PostAddCreditsRequest? Type72 { get; set; } + /// + /// + /// + public global::Ideogram.PostInternalTesting200Response? Type73 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Ideogram/openapi.yaml b/src/libs/Ideogram/openapi.yaml index d766257..104b628 100644 --- a/src/libs/Ideogram/openapi.yaml +++ b/src/libs/Ideogram/openapi.yaml @@ -171,6 +171,40 @@ paths: schema: $ref: '#/components/schemas/postInternalTesting_200_response' x-openapi-router-controller: external_api.generated.openapi.controllers.internal_testing_controller + /manage/api/add_credits: + post: + tags: + - manage + summary: Add credits to an API user's account. + operationId: post_add_credits_for_api + requestBody: + description: A request to add credits to an API user's account. + content: + application/json: + schema: + $ref: '#/components/schemas/PostAddCreditsRequest' + required: true + x-body-name: post_add_credits_request + responses: + '200': + description: API subscription content + content: + application/json: + schema: + $ref: '#/components/schemas/PostAddCreditsResponse' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/PostAddCreditsError' + '401': + description: Not authorized + '403': + description: Not authorized + security: + - BearerAuth: [ ] + x-openapi-router-controller: external_api.generated.openapi.controllers.manage_controller /manage/api/api_keys: get: tags: @@ -1607,6 +1641,46 @@ components: example: TOS_2024_04_20 example: terms_id: TOS_2024_04_20 + PostAddCreditsResponse: + title: PostAddCreditsResponse + required: + - amount + type: object + properties: + amount: + $ref: '#/components/schemas/Price' + example: + amount: + amount: 1050 + currency_code: USD + PostAddCreditsError: + title: PostAddCreditsError + type: object + properties: + messages: + title: messages + type: array + items: + type: string + description: 'An error message, indicating what went wrong.' + description: Error messages about what the error could be. + description: Represents an error when attempting to add credits to an API user's account. + example: + messages: + - messages + - messages + PostAddCreditsRequest: + title: PostAddCreditsRequest + required: + - amount + type: object + properties: + amount: + $ref: '#/components/schemas/Price' + example: + amount: + amount: 1050 + currency_code: USD Description: title: Description type: object