diff --git a/src/libs/Ideogram/Generated/Ideogram.AutoSDKHttpResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..44faf45 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.BatchClient.GetMaybeBatchResults.g.cs b/src/libs/Ideogram/Generated/Ideogram.BatchClient.GetMaybeBatchResults.g.cs index ea616c2..be3731f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.BatchClient.GetMaybeBatchResults.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.BatchClient.GetMaybeBatchResults.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetMaybeBatchResultsResponseContent( string jobId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetMaybeBatchResultsAsResponseAsync( + jobId: jobId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get Batch Magic Prompt Job Results if available.
+ /// Gets the results of a batch magic prompt job if available. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetMaybeBatchResultsAsResponseAsync( + string jobId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetMaybeBatchResultsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/internal/batch/get-maybe-batch-results/{jobId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetMaybeBatchResultsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetMaybeBatchResultsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -307,17 +347,16 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -340,17 +379,16 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -373,17 +411,16 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 500) @@ -406,17 +443,16 @@ partial void ProcessGetMaybeBatchResultsResponseContent( __exception_500 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -440,23 +476,25 @@ partial void ProcessGetMaybeBatchResultsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.InternalBatchResultsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.InternalBatchResultsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -470,9 +508,13 @@ partial void ProcessGetMaybeBatchResultsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.InternalBatchResultsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.InternalBatchResultsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -489,17 +531,15 @@ partial void ProcessGetMaybeBatchResultsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.BatchClient.PostBatch.g.cs b/src/libs/Ideogram/Generated/Ideogram.BatchClient.PostBatch.g.cs index ec458d4..ebba2b2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.BatchClient.PostBatch.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.BatchClient.PostBatch.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostBatchResponseContent( /// public async global::System.Threading.Tasks.Task PostBatchAsync( + global::Ideogram.InternalBatchRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostBatchAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Initiate Batch Magic Prompt Evalution
+ /// Runs automated evaluation of multiple LLM models and system prompts for magic prompt generation.
+ /// Generates images using large batches of user prompt inputs. Internal use only (feature flagged). + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostBatchAsResponseAsync( + global::Ideogram.InternalBatchRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -86,6 +110,7 @@ partial void ProcessPostBatchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/internal/batch", baseUri: HttpClient.BaseAddress); @@ -165,6 +190,8 @@ partial void ProcessPostBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +202,11 @@ partial void ProcessPostBatchResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +224,8 @@ partial void ProcessPostBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +235,7 @@ partial void ProcessPostBatchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +244,11 @@ partial void ProcessPostBatchResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +265,15 @@ partial void ProcessPostBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +313,8 @@ partial void ProcessPostBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +335,8 @@ partial void ProcessPostBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -317,17 +360,16 @@ partial void ProcessPostBatchResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -350,17 +392,16 @@ partial void ProcessPostBatchResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -383,17 +424,16 @@ partial void ProcessPostBatchResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 500) @@ -416,17 +456,16 @@ partial void ProcessPostBatchResponseContent( __exception_500 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -450,23 +489,25 @@ partial void ProcessPostBatchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.InternalBatchResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.InternalBatchResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -480,9 +521,13 @@ partial void ProcessPostBatchResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.InternalBatchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.InternalBatchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -499,17 +544,15 @@ partial void ProcessPostBatchResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -534,7 +577,7 @@ partial void ProcessPostBatchResponseContent( /// Example: MAGIC_PROMPT_NO_TEXT /// /// - /// Example: {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// Example: {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/Ideogram/Generated/Ideogram.BatchClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.BatchClient.g.cs index 4b1418e..4574a23 100644 --- a/src/libs/Ideogram/Generated/Ideogram.BatchClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.BatchClient.g.cs @@ -61,6 +61,27 @@ public BatchClient( { } + /// + /// Creates a new instance of the BatchClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public BatchClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the BatchClient. /// If no httpClient is provided, a new one will be created. @@ -72,10 +93,10 @@ public BatchClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public BatchClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.CreateDataset.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.CreateDataset.g.cs index 6fefee1..9117361 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.CreateDataset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.CreateDataset.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateDatasetResponseContent( /// public async global::System.Threading.Tasks.Task CreateDatasetAsync( + global::Ideogram.CreateDatasetRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateDatasetAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new dataset
+ /// Creates a new dataset + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateDatasetAsResponseAsync( + global::Ideogram.CreateDatasetRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateDatasetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/datasets", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateDatasetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessCreateDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessCreateDatasetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessCreateDatasetResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessCreateDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessCreateDatasetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateDatasetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -316,17 +358,16 @@ partial void ProcessCreateDatasetResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -349,17 +390,16 @@ partial void ProcessCreateDatasetResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -383,23 +423,25 @@ partial void ProcessCreateDatasetResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.Dataset.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.Dataset.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -413,9 +455,13 @@ partial void ProcessCreateDatasetResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.Dataset.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.Dataset.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -432,17 +478,15 @@ partial void ProcessCreateDatasetResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.GetDataset.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.GetDataset.g.cs index d7d49fa..7c4431e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.GetDataset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.GetDataset.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetDatasetResponseContent( string datasetId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetDatasetAsResponseAsync( + datasetId: datasetId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a dataset
+ /// Returns a dataset by ID, including the total number of files and a list of each file's name and size in bytes. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetDatasetAsResponseAsync( + string datasetId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetDatasetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/datasets/{datasetId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetDatasetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetDatasetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetDatasetResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetDatasetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetDatasetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetDatasetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -307,17 +347,16 @@ partial void ProcessGetDatasetResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -340,17 +379,16 @@ partial void ProcessGetDatasetResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -374,23 +412,25 @@ partial void ProcessGetDatasetResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetDatasetResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetDatasetResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -404,9 +444,13 @@ partial void ProcessGetDatasetResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetDatasetResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetDatasetResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,17 +467,15 @@ partial void ProcessGetDatasetResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.ListDatasets.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.ListDatasets.g.cs index 437f498..93f1876 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.ListDatasets.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.ListDatasets.g.cs @@ -49,6 +49,24 @@ partial void ProcessListDatasetsResponseContent( public async global::System.Threading.Tasks.Task ListDatasetsAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListDatasetsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List datasets
+ /// Lists all datasets for the authenticated user + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListDatasetsAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessListDatasetsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/datasets", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessListDatasetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessListDatasetsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessListDatasetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessListDatasetsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessListDatasetsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessListDatasetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessListDatasetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessListDatasetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -301,17 +338,16 @@ partial void ProcessListDatasetsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -335,23 +371,25 @@ partial void ProcessListDatasetsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ListDatasetsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ListDatasetsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -365,9 +403,13 @@ partial void ProcessListDatasetsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ListDatasetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ListDatasetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -384,17 +426,15 @@ partial void ProcessListDatasetsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.TrainDatasetModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.TrainDatasetModel.g.cs index da3f5e2..0fa8f8d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.TrainDatasetModel.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.TrainDatasetModel.g.cs @@ -55,6 +55,32 @@ partial void ProcessTrainDatasetModelResponseContent( public async global::System.Threading.Tasks.Task TrainDatasetModelAsync( string datasetId, + global::Ideogram.TrainDatasetModelRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TrainDatasetModelAsResponseAsync( + datasetId: datasetId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Train a model from a dataset
+ /// Start training a custom model from a dataset. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> TrainDatasetModelAsResponseAsync( + string datasetId, + global::Ideogram.TrainDatasetModelRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +116,7 @@ partial void ProcessTrainDatasetModelResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/datasets/{datasetId}/train_model", baseUri: HttpClient.BaseAddress); @@ -170,6 +197,8 @@ partial void ProcessTrainDatasetModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -180,6 +209,11 @@ partial void ProcessTrainDatasetModelResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -197,6 +231,8 @@ partial void ProcessTrainDatasetModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -206,8 +242,7 @@ partial void ProcessTrainDatasetModelResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -216,6 +251,11 @@ partial void ProcessTrainDatasetModelResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -232,14 +272,15 @@ partial void ProcessTrainDatasetModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -279,6 +320,8 @@ partial void ProcessTrainDatasetModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -299,6 +342,8 @@ partial void ProcessTrainDatasetModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -322,17 +367,16 @@ partial void ProcessTrainDatasetModelResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -355,17 +399,16 @@ partial void ProcessTrainDatasetModelResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -388,17 +431,16 @@ partial void ProcessTrainDatasetModelResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -422,23 +464,25 @@ partial void ProcessTrainDatasetModelResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -452,9 +496,13 @@ partial void ProcessTrainDatasetModelResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -471,17 +519,15 @@ partial void ProcessTrainDatasetModelResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.UploadDatasetAssets.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.UploadDatasetAssets.g.cs index 80697f7..fbe4f90 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.UploadDatasetAssets.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.UploadDatasetAssets.g.cs @@ -55,6 +55,32 @@ partial void ProcessUploadDatasetAssetsResponseContent( public async global::System.Threading.Tasks.Task UploadDatasetAssetsAsync( string datasetId, + global::Ideogram.UploadDatasetAssetsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadDatasetAssetsAsResponseAsync( + datasetId: datasetId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UploadDatasetAssetsAsResponseAsync( + string datasetId, + global::Ideogram.UploadDatasetAssetsRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -86,10 +112,11 @@ partial void ProcessUploadDatasetAssetsResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/datasets/{datasetId}/upload_assets", baseUri: HttpClient.BaseAddress); @@ -122,10 +149,12 @@ partial void ProcessUploadDatasetAssetsResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(datasetId ?? string.Empty), name: "\"dataset_id\""); + for (var __iFiles = 0; __iFiles < request.Files.Count; __iFiles++) { var __contentFiles = new global::System.Net.Http.ByteArrayContent(request.Files[__iFiles]); @@ -139,7 +168,9 @@ partial void ProcessUploadDatasetAssetsResponseContent( __contentFiles.Headers.ContentDisposition.FileNameStar = null; } } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -182,6 +213,8 @@ partial void ProcessUploadDatasetAssetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +225,11 @@ partial void ProcessUploadDatasetAssetsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -209,6 +247,8 @@ partial void ProcessUploadDatasetAssetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +258,7 @@ partial void ProcessUploadDatasetAssetsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +267,11 @@ partial void ProcessUploadDatasetAssetsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -244,14 +288,15 @@ partial void ProcessUploadDatasetAssetsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -291,6 +336,8 @@ partial void ProcessUploadDatasetAssetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +358,8 @@ partial void ProcessUploadDatasetAssetsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -334,17 +383,16 @@ partial void ProcessUploadDatasetAssetsResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -367,17 +415,16 @@ partial void ProcessUploadDatasetAssetsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -400,17 +447,16 @@ partial void ProcessUploadDatasetAssetsResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -434,23 +480,25 @@ partial void ProcessUploadDatasetAssetsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.UploadDatasetAssetsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.UploadDatasetAssetsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -464,9 +512,13 @@ partial void ProcessUploadDatasetAssetsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.UploadDatasetAssetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.UploadDatasetAssetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -483,17 +535,15 @@ partial void ProcessUploadDatasetAssetsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -532,5 +582,1050 @@ partial void ProcessUploadDatasetAssetsResponseContent( requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// + /// + /// Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional! + /// + /// + /// Optional file names to use for the multipart 'files' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UploadDatasetAssetsAsync( + string datasetId, + global::System.Collections.Generic.IReadOnlyList files, + global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + files = files ?? throw new global::System.ArgumentNullException(nameof(files)); + var request = new global::Ideogram.UploadDatasetAssetsRequest + { + Files = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PrepareUploadDatasetAssetsArguments( + httpClient: HttpClient, + datasetId: ref datasetId, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadDatasetAssetsSecurityRequirements, + operationName: "UploadDatasetAssetsAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: $"/datasets/{datasetId}/upload_assets", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(datasetId ?? string.Empty), + name: "\"dataset_id\""); + + for (var __iFiles = 0; __iFiles < files.Count; __iFiles++) + { + var __fileNameFiles = filesFileNames != null && + __iFiles < filesFileNames.Count && + filesFileNames[__iFiles] != null + ? filesFileNames[__iFiles] + : $"file{__iFiles}.bin"; + var __contentFiles = new global::System.Net.Http.StreamContent(files[__iFiles]); + __contentFiles.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles) ?? 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: __contentFiles, + name: "\"files\"", + fileName: $"\"{__fileNameFiles}\""); + if (__contentFiles.Headers.ContentDisposition != null) + { + __contentFiles.Headers.ContentDisposition.FileNameStar = null; + } + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadDatasetAssetsRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + datasetId: datasetId!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadDatasetAssetsResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadDatasetAssetsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.UploadDatasetAssetsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.UploadDatasetAssetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// + /// + /// Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional! + /// + /// + /// Optional file names to use for the multipart 'files' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UploadDatasetAssetsAsResponseAsync( + string datasetId, + global::System.Collections.Generic.IReadOnlyList files, + global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + files = files ?? throw new global::System.ArgumentNullException(nameof(files)); + var request = new global::Ideogram.UploadDatasetAssetsRequest + { + Files = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PrepareUploadDatasetAssetsArguments( + httpClient: HttpClient, + datasetId: ref datasetId, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadDatasetAssetsSecurityRequirements, + operationName: "UploadDatasetAssetsAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: $"/datasets/{datasetId}/upload_assets", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(datasetId ?? string.Empty), + name: "\"dataset_id\""); + + for (var __iFiles = 0; __iFiles < files.Count; __iFiles++) + { + var __fileNameFiles = filesFileNames != null && + __iFiles < filesFileNames.Count && + filesFileNames[__iFiles] != null + ? filesFileNames[__iFiles] + : $"file{__iFiles}.bin"; + var __contentFiles = new global::System.Net.Http.StreamContent(files[__iFiles]); + __contentFiles.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameFiles is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameFiles) ?? 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: __contentFiles, + name: "\"files\"", + fileName: $"\"{__fileNameFiles}\""); + if (__contentFiles.Headers.ContentDisposition != null) + { + __contentFiles.Headers.ContentDisposition.FileNameStar = null; + } + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadDatasetAssetsRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + datasetId: datasetId!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUploadDatasetAssetsResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadDatasetAssets", + methodName: "UploadDatasetAssetsAsync", + pathTemplate: "$\"/datasets/{datasetId}/upload_assets\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUploadDatasetAssetsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.UploadDatasetAssetsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.UploadDatasetAssetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.g.cs index feacc49..0d8c320 100644 --- a/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.DatasetsClient.g.cs @@ -62,6 +62,27 @@ public DatasetsClient( { } + /// + /// Creates a new instance of the DatasetsClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public DatasetsClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the DatasetsClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public DatasetsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public DatasetsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.Exceptions.g.cs b/src/libs/Ideogram/Generated/Ideogram.Exceptions.g.cs index 4fe7cb2..cd05323 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Exceptions.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Exceptions.g.cs @@ -12,16 +12,19 @@ public partial class ApiException : global::System.Exception /// The HTTP status code of the response. /// public global::System.Net.HttpStatusCode StatusCode { get; } + /// /// The response body as a string, or null if the body could not be read. /// This is always populated for error responses regardless of the ReadResponseAsString setting. /// For success-path failures (e.g. deserialization errors), the client attempts a best-effort read. /// public string? ResponseBody { get; set; } + /// /// The response headers. /// public global::System.Collections.Generic.Dictionary>? ResponseHeaders { get; set; } + /// /// Initializes a new instance of the class. /// @@ -49,6 +52,103 @@ public ApiException(string message, global::System.Exception? innerException, gl { StatusCode = statusCode; } + + /// + /// Constructs an instance whose runtime type matches the response status code when the typed exception hierarchy is enabled. Always returns a plain when the hierarchy is disabled. + /// + /// The HTTP status code of the response. + /// The error message. + /// An inner exception, when one is available. + /// The response headers; consulted for 429 Retry-After parsing when present. + public static global::Ideogram.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Ideogram.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::Ideogram.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::Ideogram.ApiException.Create(statusCode, message, innerException, responseHeaders); + exception.ResponseBody = responseBody; + exception.ResponseHeaders = responseHeaders; + return exception; + } + + /// + /// Parses a Retry-After response header (delta-seconds or HTTP-date) into a . + /// Returns null when the header is missing or unparseable. Public so consumer code that observes + /// directly can recover the value without re-implementing the parser. + /// + public static global::System.TimeSpan? TryParseRetryAfter( + global::System.Collections.Generic.IDictionary>? headers) + { + if (headers == null) + { + return null; + } + + global::System.Collections.Generic.IEnumerable? values = null; + foreach (var entry in headers) + { + if (string.Equals(entry.Key, "Retry-After", global::System.StringComparison.OrdinalIgnoreCase)) + { + values = entry.Value; + break; + } + } + + if (values == null) + { + return null; + } + + string? raw = null; + foreach (var value in values) + { + if (!string.IsNullOrWhiteSpace(value)) + { + raw = value.Trim(); + break; + } + } + + if (string.IsNullOrEmpty(raw)) + { + return null; + } + + if (int.TryParse( + raw, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var seconds) && seconds >= 0) + { + return global::System.TimeSpan.FromSeconds(seconds); + } + + if (global::System.DateTimeOffset.TryParse( + raw, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var when)) + { + var delta = when - global::System.DateTimeOffset.UtcNow; + return delta > global::System.TimeSpan.Zero ? delta : global::System.TimeSpan.Zero; + } + + return null; + } } /// @@ -88,5 +188,39 @@ public ApiException(string message, global::System.Net.HttpStatusCode statusCode public ApiException(string message, global::System.Exception? innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) { } + + /// + /// Constructs an whose runtime type matches the response status code when the typed exception hierarchy is enabled. + /// + /// The HTTP status code of the response. + /// The error message. + /// An inner exception, when one is available. + /// The response headers; consulted for 429 Retry-After parsing when present. + public static new global::Ideogram.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Ideogram.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::Ideogram.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + T? responseObject, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::Ideogram.ApiException.Create(statusCode, message, innerException, responseHeaders); + exception.ResponseBody = responseBody; + exception.ResponseObject = responseObject; + exception.ResponseHeaders = responseHeaders; + return exception; + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.GetGeneration.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.GetGeneration.g.cs new file mode 100644 index 0000000..499781a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.GetGeneration.g.cs @@ -0,0 +1,554 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_GetGenerationSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_GetGenerationSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_GetGenerationSecurityRequirement0, + }; + partial void PrepareGetGenerationArguments( + global::System.Net.Http.HttpClient httpClient, + ref string generationId); + partial void PrepareGetGenerationRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string generationId); + partial void ProcessGetGenerationResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetGenerationResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Poll a generation
+ /// Retrieves the current status of an asynchronous generation, and its results once complete. Use the `generation_id` returned by the async generation endpoint. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetGenerationAsync( + string generationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetGenerationAsResponseAsync( + generationId: generationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Poll a generation
+ /// Retrieves the current status of an asynchronous generation, and its results once complete. Use the `generation_id` returned by the async generation endpoint. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetGenerationAsResponseAsync( + string generationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetGenerationArguments( + httpClient: HttpClient, + generationId: ref generationId); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetGenerationSecurityRequirements, + operationName: "GetGenerationAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: $"/v1/generations/{generationId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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" || + __authorization.Type == "OpenIdConnect") + { + __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); + } + } + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetGenerationRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + generationId: generationId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGeneration", + methodName: "GetGenerationAsync", + pathTemplate: "$\"/v1/generations/{generationId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGeneration", + methodName: "GetGenerationAsync", + pathTemplate: "$\"/v1/generations/{generationId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGeneration", + methodName: "GetGenerationAsync", + pathTemplate: "$\"/v1/generations/{generationId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetGenerationResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGeneration", + methodName: "GetGenerationAsync", + pathTemplate: "$\"/v1/generations/{generationId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetGeneration", + methodName: "GetGenerationAsync", + pathTemplate: "$\"/v1/generations/{generationId}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetGenerationResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GenerationResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImage.g.cs index f934dff..2e4c404 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImage.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostEditImageResponseContent( /// public async global::System.Threading.Tasks.Task PostEditImageAsync( + global::Ideogram.EditImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostEditImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostEditImageAsResponseAsync( + global::Ideogram.EditImageRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostEditImageResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/edit", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostEditImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,6 +186,7 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } + 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 @@ -195,41 +224,58 @@ request.Maskname is null { __contentMask.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), name: "\"model\""); + if (request.MagicPromptOption != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt_option\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -271,6 +317,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -281,6 +329,11 @@ request.Maskname is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -298,6 +351,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -307,8 +362,7 @@ request.Maskname is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -317,6 +371,11 @@ request.Maskname is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -333,14 +392,15 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -380,6 +440,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -400,6 +462,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -423,17 +487,16 @@ request.Maskname is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -456,17 +519,16 @@ request.Maskname is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or Initial Image failed the safety checks. if ((int)__response.StatusCode == 422) @@ -493,18 +555,17 @@ request.Maskname is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -527,17 +588,16 @@ request.Maskname is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -561,23 +621,25 @@ request.Maskname is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -591,9 +653,13 @@ request.Maskname is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -610,17 +676,15 @@ request.Maskname is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -663,6 +727,9 @@ request.Maskname is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -686,6 +753,7 @@ request.Maskname is null string prompt, global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.StyleType? styleType = default, @@ -701,6 +769,7 @@ request.Maskname is null Prompt = prompt, Model = model, MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NumImages = numImages, Seed = seed, StyleType = styleType, @@ -711,5 +780,1380 @@ request.Maskname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset. + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostEditImageAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + mask = mask ?? throw new global::System.ArgumentNullException(nameof(mask)); + var request = new global::Ideogram.EditImageRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Prompt = prompt, + Model = model, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + StyleType = styleType, + }; + PrepareArguments( + client: HttpClient); + PreparePostEditImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostEditImageSecurityRequirements, + operationName: "PostEditImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/edit", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __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\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), + name: "\"model\""); + + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostEditImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostEditImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostEditImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset. + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostEditImageAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + mask = mask ?? throw new global::System.ArgumentNullException(nameof(mask)); + var request = new global::Ideogram.EditImageRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Prompt = prompt, + Model = model, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + StyleType = styleType, + }; + PrepareArguments( + client: HttpClient); + PreparePostEditImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostEditImageSecurityRequirements, + operationName: "PostEditImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/edit", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __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\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), + name: "\"model\""); + + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostEditImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostEditImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostEditImage", + methodName: "PostEditImageAsync", + pathTemplate: "\"/edit\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostEditImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV3.g.cs index 90a5817..6f2832a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV3.g.cs @@ -53,6 +53,31 @@ partial void ProcessPostGenerateDesignV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostGenerateDesignV3Async( + global::Ideogram.GenerateDesignRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateDesignV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate a design from a text prompt with text detection and correction
+ /// Generates a design synchronously from a text prompt using the Ideogram 3.0 model, then detects and corrects text layers within the generated image.
+ /// The response includes the generated image URL along with detected text layers (with font, size, color, position) and image asset layers.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateDesignV3AsResponseAsync( + global::Ideogram.GenerateDesignRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,10 +108,11 @@ partial void ProcessPostGenerateDesignV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/generate-design", baseUri: HttpClient.BaseAddress); @@ -119,94 +145,116 @@ partial void ProcessPostGenerateDesignV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.Resolution != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), name: "\"resolution\""); - } + + } if (request.AspectRatio != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), name: "\"aspect_ratio\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NegativePrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); - } + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); - } + + } if (request.FontFileH1 != default) { @@ -247,14 +295,16 @@ request.FontFileH1name is null { __contentFontFileH1.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameH1 != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameH1 ?? string.Empty), name: "\"font_name_h1\""); - } + + } if (request.FontFileH2 != default) { @@ -295,14 +345,16 @@ request.FontFileH2name is null { __contentFontFileH2.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameH2 != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameH2 ?? string.Empty), name: "\"font_name_h2\""); - } + + } if (request.FontFileBody != default) { @@ -343,14 +395,16 @@ request.FontFileBodyname is null { __contentFontFileBody.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameBody != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameBody ?? string.Empty), name: "\"font_name_body\""); - } + + } if (request.FontFileSmall != default) { @@ -391,14 +445,16 @@ request.FontFileSmallname is null { __contentFontFileSmall.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameSmall != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameSmall ?? string.Empty), name: "\"font_name_small\""); - } + + } if (request.StyleReferenceImages != default) { @@ -415,7 +471,8 @@ request.FontFileSmallname is null __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.ReferenceAssetImages != default) { @@ -432,8 +489,11 @@ request.FontFileSmallname is null __contentReferenceAssetImages.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -475,6 +535,8 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -485,6 +547,11 @@ request.FontFileSmallname is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -502,6 +569,8 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -511,8 +580,7 @@ request.FontFileSmallname is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -521,6 +589,11 @@ request.FontFileSmallname is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -537,14 +610,15 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -584,6 +658,8 @@ request.FontFileSmallname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -604,6 +680,8 @@ request.FontFileSmallname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -627,17 +705,16 @@ request.FontFileSmallname is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -660,17 +737,16 @@ request.FontFileSmallname is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt failed the safety check. if ((int)__response.StatusCode == 422) @@ -697,18 +773,17 @@ request.FontFileSmallname is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -731,17 +806,16 @@ request.FontFileSmallname is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -765,23 +839,25 @@ request.FontFileSmallname is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -795,9 +871,13 @@ request.FontFileSmallname is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -814,17 +894,15 @@ request.FontFileSmallname is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -864,6 +942,9 @@ request.FontFileSmallname is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from a design. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -947,6 +1028,7 @@ request.FontFileSmallname is null global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, @@ -979,6 +1061,7 @@ request.FontFileSmallname is null AspectRatio = aspectRatio, RenderingSpeed = renderingSpeed, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NegativePrompt = negativePrompt, NumImages = numImages, ColorPalette = colorPalette, diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4.g.cs similarity index 56% rename from src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImageV3.g.cs rename to src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4.g.cs index 517be4f..4a1f4e4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostEditImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4.g.cs @@ -7,7 +7,7 @@ public partial class GenerateClient { - private static readonly global::Ideogram.EndPointSecurityRequirement s_PostEditImageV3SecurityRequirement0 = + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateDesignV4SecurityRequirement0 = new global::Ideogram.EndPointSecurityRequirement { Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] @@ -21,40 +21,64 @@ public partial class GenerateClient }, }, }; - private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostEditImageV3SecurityRequirements = + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateDesignV4SecurityRequirements = new global::Ideogram.EndPointSecurityRequirement[] - { s_PostEditImageV3SecurityRequirement0, + { s_PostGenerateDesignV4SecurityRequirement0, }; - partial void PreparePostEditImageV3Arguments( + partial void PreparePostGenerateDesignV4Arguments( global::System.Net.Http.HttpClient httpClient, - global::Ideogram.EditImageRequestV3 request); - partial void PreparePostEditImageV3Request( + global::Ideogram.GenerateDesignRequestV4 request); + partial void PreparePostGenerateDesignV4Request( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, - global::Ideogram.EditImageRequestV3 request); - partial void ProcessPostEditImageV3Response( + global::Ideogram.GenerateDesignRequestV4 request); + partial void ProcessPostGenerateDesignV4Response( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); - partial void ProcessPostEditImageV3ResponseContent( + partial void ProcessPostGenerateDesignV4ResponseContent( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage, ref string content); /// - /// Edit with Ideogram 3.0
- /// Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
- /// should be edited, while the prompt and chosen style can further guide the edit.
- /// Supported image formats include JPEG, PNG, and WebP.
+ /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. ///
/// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task PostEditImageV3Async( + public async global::System.Threading.Tasks.Task PostGenerateDesignV4Async( - global::Ideogram.EditImageRequestV3 request, + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateDesignV4AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateDesignV4AsResponseAsync( + + global::Ideogram.GenerateDesignRequestV4 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { @@ -62,15 +86,15 @@ partial void ProcessPostEditImageV3ResponseContent( PrepareArguments( client: HttpClient); - PreparePostEditImageV3Arguments( + PreparePostGenerateDesignV4Arguments( httpClient: HttpClient, request: request); var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( availableAuthorizations: Authorizations, - securityRequirements: s_PostEditImageV3SecurityRequirements, - operationName: "PostEditImageV3Async"); + securityRequirements: s_PostGenerateDesignV4SecurityRequirements, + operationName: "PostGenerateDesignV4Async"); using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( clientOptions: Options, @@ -84,12 +108,13 @@ partial void ProcessPostEditImageV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( - path: "/v1/ideogram-v3/edit", + path: "/v1/ideogram-v4/generate-design", baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -120,199 +145,105 @@ partial void ProcessPostEditImageV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - 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\"", - fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); - if (__contentImage.Headers.ContentDisposition != null) - { - __contentImage.Headers.ContentDisposition.FileNameStar = null; - } - 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\"", - fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); - if (__contentMask.Headers.ContentDisposition != null) - { - __contentMask.Headers.ContentDisposition.FileNameStar = null; - } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); - if (request.MagicPrompt != default) - { - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), - name: "\"magic_prompt\""); - } - if (request.NumImages != default) - { - - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), - name: "\"num_images\""); - } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } - if (request.RenderingSpeed != default) - { - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), - name: "\"rendering_speed\""); - } - if (request.StyleType != default) + } + if (request.MagicPromptOption != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), - name: "\"style_type\""); - } - if (request.StylePreset != default) - { + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), - name: "\"style_preset\""); - } - if (request.CustomModelUri != default) + } + if (request.MagicPromptSystemPromptConfigId != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), - name: "\"custom_model_uri\""); - } - if (request.ColorPalette != default) + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), - name: "\"color_palette\""); - } - if (request.StyleCodes != default) + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), - name: "\"style_codes\""); - } - if (request.StyleReferenceImages != default) + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.InspirationReferenceImages != default) { - for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < request.StyleReferenceImages.Count; __iStyleReferenceImages++) + for (var __iInspirationReferenceImages = 0; __iInspirationReferenceImages < request.InspirationReferenceImages.Count; __iInspirationReferenceImages++) { - var __contentStyleReferenceImages = new global::System.Net.Http.ByteArrayContent(request.StyleReferenceImages[__iStyleReferenceImages]); - __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); + var __contentInspirationReferenceImages = new global::System.Net.Http.ByteArrayContent(request.InspirationReferenceImages[__iInspirationReferenceImages]); + __contentInspirationReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); __httpRequestContent.Add( - content: __contentStyleReferenceImages, - name: "\"style_reference_images\"", - fileName: $"\"file{__iStyleReferenceImages}.bin\""); - if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + content: __contentInspirationReferenceImages, + name: "\"inspiration_reference_images\"", + fileName: $"\"file{__iInspirationReferenceImages}.bin\""); + if (__contentInspirationReferenceImages.Headers.ContentDisposition != null) { - __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + __contentInspirationReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } - if (request.CharacterReferenceImages != default) + + } + if (request.InspirationReferenceModel != default) { - for (var __iCharacterReferenceImages = 0; __iCharacterReferenceImages < request.CharacterReferenceImages.Count; __iCharacterReferenceImages++) - { - var __contentCharacterReferenceImages = new global::System.Net.Http.ByteArrayContent(request.CharacterReferenceImages[__iCharacterReferenceImages]); - __contentCharacterReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); - __httpRequestContent.Add( - content: __contentCharacterReferenceImages, - name: "\"character_reference_images\"", - fileName: $"\"file{__iCharacterReferenceImages}.bin\""); - if (__contentCharacterReferenceImages.Headers.ContentDisposition != null) - { - __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; - } - } - } - if (request.CharacterReferenceImagesMask != default) + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.InspirationReferenceModel).HasValue ? (request.InspirationReferenceModel).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"inspiration_reference_model\""); + + } + if (request.ArtifactGenerationModel != default) { - for (var __iCharacterReferenceImagesMask = 0; __iCharacterReferenceImagesMask < request.CharacterReferenceImagesMask.Count; __iCharacterReferenceImagesMask++) - { - var __contentCharacterReferenceImagesMask = new global::System.Net.Http.ByteArrayContent(request.CharacterReferenceImagesMask[__iCharacterReferenceImagesMask]); - __contentCharacterReferenceImagesMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); - __httpRequestContent.Add( - content: __contentCharacterReferenceImagesMask, - name: "\"character_reference_images_mask\"", - fileName: $"\"file{__iCharacterReferenceImagesMask}.bin\""); - if (__contentCharacterReferenceImagesMask.Headers.ContentDisposition != null) - { - __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; - } - } + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.ArtifactGenerationModel).HasValue ? (request.ArtifactGenerationModel).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"artifact_generation_model\""); + + } + if (request.Layout2imageVariant != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Layout2imageVariant).HasValue ? (request.Layout2imageVariant).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"layout2image_variant\""); + } + if (request.ResponseType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.ResponseType).HasValue ? (request.ResponseType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"response_type\""); + + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -321,7 +252,7 @@ request.Maskname is null PrepareRequest( client: HttpClient, request: __httpRequest); - PreparePostEditImageV3Request( + PreparePostGenerateDesignV4Request( httpClient: HttpClient, httpRequestMessage: __httpRequest, request: request); @@ -341,9 +272,9 @@ request.Maskname is null await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "PostEditImageV3", - methodName: "PostEditImageV3Async", - pathTemplate: "\"/v1/ideogram-v3/edit\"", + operationId: "PostGenerateDesignV4", + methodName: "PostGenerateDesignV4Async", + pathTemplate: "\"/v1/ideogram-v4/generate-design\"", httpMethod: "POST", baseUri: BaseUri, request: __httpRequest!, @@ -354,6 +285,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -364,13 +297,18 @@ request.Maskname is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "PostEditImageV3", - methodName: "PostEditImageV3Async", - pathTemplate: "\"/v1/ideogram-v3/edit\"", + operationId: "PostGenerateDesignV4", + methodName: "PostGenerateDesignV4Async", + pathTemplate: "\"/v1/ideogram-v4/generate-design\"", httpMethod: "POST", baseUri: BaseUri, request: __httpRequest!, @@ -381,6 +319,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -390,8 +330,7 @@ request.Maskname is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -400,12 +339,17 @@ request.Maskname is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "PostEditImageV3", - methodName: "PostEditImageV3Async", - pathTemplate: "\"/v1/ideogram-v3/edit\"", + operationId: "PostGenerateDesignV4", + methodName: "PostGenerateDesignV4Async", + pathTemplate: "\"/v1/ideogram-v4/generate-design\"", httpMethod: "POST", baseUri: BaseUri, request: __httpRequest!, @@ -416,14 +360,15 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -442,7 +387,7 @@ request.Maskname is null ProcessResponse( client: HttpClient, response: __response); - ProcessPostEditImageV3Response( + ProcessPostGenerateDesignV4Response( httpClient: HttpClient, httpResponseMessage: __response); if (__response.IsSuccessStatusCode) @@ -450,9 +395,9 @@ request.Maskname is null await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "PostEditImageV3", - methodName: "PostEditImageV3Async", - pathTemplate: "\"/v1/ideogram-v3/edit\"", + operationId: "PostGenerateDesignV4", + methodName: "PostGenerateDesignV4Async", + pathTemplate: "\"/v1/ideogram-v4/generate-design\"", httpMethod: "POST", baseUri: BaseUri, request: __httpRequest!, @@ -463,6 +408,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -470,9 +417,9 @@ request.Maskname is null await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( - operationId: "PostEditImageV3", - methodName: "PostEditImageV3Async", - pathTemplate: "\"/v1/ideogram-v3/edit\"", + operationId: "PostGenerateDesignV4", + methodName: "PostGenerateDesignV4Async", + pathTemplate: "\"/v1/ideogram-v4/generate-design\"", httpMethod: "POST", baseUri: BaseUri, request: __httpRequest!, @@ -483,6 +430,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -506,17 +455,16 @@ request.Maskname is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -539,19 +487,18 @@ request.Maskname is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } - // Prompt or Initial Image failed the safety checks. + // Prompt failed the safety check. if ((int)__response.StatusCode == 422) { string? __content_422 = null; @@ -576,18 +523,17 @@ request.Maskname is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -610,17 +556,16 @@ request.Maskname is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -635,7 +580,7 @@ request.Maskname is null client: HttpClient, response: __response, content: ref __content); - ProcessPostEditImageV3ResponseContent( + ProcessPostGenerateDesignV4ResponseContent( httpClient: HttpClient, httpResponseMessage: __response, content: ref __content); @@ -644,23 +589,25 @@ request.Maskname is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostGenerateDesignV4200Response.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -674,9 +621,13 @@ request.Maskname is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostGenerateDesignV4200Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -693,17 +644,15 @@ request.Maskname is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -715,120 +664,89 @@ request.Maskname is null } } /// - /// Edit with Ideogram 3.0
- /// Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
- /// should be edited, while the prompt and chosen style can further guide the edit.
- /// Supported image formats include JPEG, PNG, and WebP.
+ /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. ///
- /// - /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. - /// /// - /// The prompt used to describe the edited result.
- /// Example: A photo of a cat. + /// The text prompt for editable design generation. /// - /// + /// + /// Random seed for reproducibility. + /// + /// /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// - /// - /// The number of images to generate.
- /// Default Value: 1 + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. /// - /// - /// Random seed. Set for reproducible generation.
- /// Example: 12345 + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 /// /// - /// The rendering speed to use.
- /// Default Value: DEFAULT - /// - /// - /// The style type to generate with.
- /// Default Value: GENERAL
- /// Example: GENERAL - /// - /// - /// A predefined style preset that applies a specific artistic style to the generated image.
- /// Example: BRIGHT_ART - /// - /// - /// A custom model URI in the format model/<model_name>/version/<version_name>.
- /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
- /// Example: model/my-custom-model/version/1 + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. /// - /// - /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. /// - /// - /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
- /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 /// - /// - /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 /// - /// - /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. /// - /// - /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - public async global::System.Threading.Tasks.Task PostEditImageV3Async( - byte[] image, - string imagename, - byte[] mask, - string maskname, + public async global::System.Threading.Tasks.Task PostGenerateDesignV4Async( string prompt, - global::Ideogram.MagicPromptOption? magicPrompt = default, - int? numImages = default, int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4Layout? resolution = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, - global::Ideogram.StyleTypeV3? styleType = default, - global::Ideogram.StylePresetV3? stylePreset = default, - string? customModelUri = default, - global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, - global::System.Collections.Generic.IList? styleCodes = default, - global::System.Collections.Generic.IList? styleReferenceImages = default, - global::System.Collections.Generic.IList? characterReferenceImages = default, - global::System.Collections.Generic.IList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IList? inspirationReferenceImages = default, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? inspirationReferenceModel = default, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? artifactGenerationModel = default, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? layout2imageVariant = default, + global::Ideogram.GenerateDesignRequestV4ResponseType? responseType = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { - var __request = new global::Ideogram.EditImageRequestV3 + var __request = new global::Ideogram.GenerateDesignRequestV4 { - Image = image, - Imagename = imagename, - Mask = mask, - Maskname = maskname, Prompt = prompt, - MagicPrompt = magicPrompt, - NumImages = numImages, Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, RenderingSpeed = renderingSpeed, - StyleType = styleType, - StylePreset = stylePreset, - CustomModelUri = customModelUri, - ColorPalette = colorPalette, - StyleCodes = styleCodes, - StyleReferenceImages = styleReferenceImages, - CharacterReferenceImages = characterReferenceImages, - CharacterReferenceImagesMask = characterReferenceImagesMask, + InspirationReferenceImages = inspirationReferenceImages, + InspirationReferenceModel = inspirationReferenceModel, + ArtifactGenerationModel = artifactGenerationModel, + Layout2imageVariant = layout2imageVariant, + ResponseType = responseType, }; - return await PostEditImageV3Async( + return await PostGenerateDesignV4Async( request: __request, requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4Async.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4Async.g.cs new file mode 100644 index 0000000..d50c2e2 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateDesignV4Async.g.cs @@ -0,0 +1,804 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateDesignV4AsyncSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateDesignV4AsyncSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostGenerateDesignV4AsyncSecurityRequirement0, + }; + partial void PreparePostGenerateDesignV4AsyncArguments( + global::System.Net.Http.HttpClient httpClient, + ref string webhookUrl, + global::Ideogram.GenerateDesignRequestV4 request); + partial void PreparePostGenerateDesignV4AsyncRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string webhookUrl, + global::Ideogram.GenerateDesignRequestV4 request); + partial void ProcessPostGenerateDesignV4AsyncResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostGenerateDesignV4AsyncResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateDesignV4AsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateDesignV4AsyncAsResponseAsync( + webhookUrl: webhookUrl, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateDesignV4AsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostGenerateDesignV4AsyncArguments( + httpClient: HttpClient, + webhookUrl: ref webhookUrl, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateDesignV4AsyncSecurityRequirements, + operationName: "PostGenerateDesignV4AsyncAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/async/generate-design", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("webhook_url", webhookUrl) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(webhookUrl ?? string.Empty), + name: "\"webhook_url\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.InspirationReferenceImages != default) + { + + for (var __iInspirationReferenceImages = 0; __iInspirationReferenceImages < request.InspirationReferenceImages.Count; __iInspirationReferenceImages++) + { + var __contentInspirationReferenceImages = new global::System.Net.Http.ByteArrayContent(request.InspirationReferenceImages[__iInspirationReferenceImages]); + __contentInspirationReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); + __httpRequestContent.Add( + content: __contentInspirationReferenceImages, + name: "\"inspiration_reference_images\"", + fileName: $"\"file{__iInspirationReferenceImages}.bin\""); + if (__contentInspirationReferenceImages.Headers.ContentDisposition != null) + { + __contentInspirationReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (request.InspirationReferenceModel != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.InspirationReferenceModel).HasValue ? (request.InspirationReferenceModel).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"inspiration_reference_model\""); + + } + if (request.ArtifactGenerationModel != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.ArtifactGenerationModel).HasValue ? (request.ArtifactGenerationModel).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"artifact_generation_model\""); + + } + if (request.Layout2imageVariant != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Layout2imageVariant).HasValue ? (request.Layout2imageVariant).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"layout2image_variant\""); + + } + if (request.ResponseType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.ResponseType).HasValue ? (request.ResponseType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"response_type\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateDesignV4AsyncRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookUrl: webhookUrl!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateDesignV4Async", + methodName: "PostGenerateDesignV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateDesignV4Async", + methodName: "PostGenerateDesignV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateDesignV4Async", + methodName: "PostGenerateDesignV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateDesignV4AsyncResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateDesignV4Async", + methodName: "PostGenerateDesignV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateDesignV4Async", + methodName: "PostGenerateDesignV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateDesignV4AsyncResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.AsyncImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.AsyncImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The text prompt for editable design generation. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. + /// + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + /// + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateDesignV4AsyncAsync( + string webhookUrl, + string prompt, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4Layout? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::System.Collections.Generic.IList? inspirationReferenceImages = default, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? inspirationReferenceModel = default, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? artifactGenerationModel = default, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? layout2imageVariant = default, + global::Ideogram.GenerateDesignRequestV4ResponseType? responseType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.GenerateDesignRequestV4 + { + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + InspirationReferenceImages = inspirationReferenceImages, + InspirationReferenceModel = inspirationReferenceModel, + ArtifactGenerationModel = artifactGenerationModel, + Layout2imageVariant = layout2imageVariant, + ResponseType = responseType, + }; + + return await PostGenerateDesignV4AsyncAsync( + webhookUrl: webhookUrl, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImage.g.cs index 4220d0a..8b65465 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImage.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostGenerateImageResponseContent( /// public async global::System.Threading.Tasks.Task PostGenerateImageAsync( + global::Ideogram.GenerateImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate (legacy)
+ /// Generates images synchronously based on a given prompt and optional parameters.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageAsResponseAsync( + global::Ideogram.GenerateImageRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -86,6 +110,7 @@ partial void ProcessPostGenerateImageResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/generate", baseUri: HttpClient.BaseAddress); @@ -165,6 +190,8 @@ partial void ProcessPostGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +202,11 @@ partial void ProcessPostGenerateImageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +224,8 @@ partial void ProcessPostGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +235,7 @@ partial void ProcessPostGenerateImageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +244,11 @@ partial void ProcessPostGenerateImageResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +265,15 @@ partial void ProcessPostGenerateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +313,8 @@ partial void ProcessPostGenerateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +335,8 @@ partial void ProcessPostGenerateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -317,17 +360,16 @@ partial void ProcessPostGenerateImageResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -350,17 +392,16 @@ partial void ProcessPostGenerateImageResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt failed the safety check. if ((int)__response.StatusCode == 422) @@ -387,18 +428,17 @@ partial void ProcessPostGenerateImageResponseContent( __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -421,17 +461,16 @@ partial void ProcessPostGenerateImageResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -455,23 +494,25 @@ partial void ProcessPostGenerateImageResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -485,9 +526,13 @@ partial void ProcessPostGenerateImageResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -504,17 +549,15 @@ partial void ProcessPostGenerateImageResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3.g.cs index d8b9e2a..a051baf 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostGenerateImageV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostGenerateImageV3Async( + global::Ideogram.GenerateImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate with Ideogram 3.0
+ /// Generates images synchronously based on a given prompt and optional parameters using the Ideogram 3.0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV3AsResponseAsync( + global::Ideogram.GenerateImageRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -82,10 +106,11 @@ partial void ProcessPostGenerateImageV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/generate", baseUri: HttpClient.BaseAddress); @@ -118,94 +143,116 @@ partial void ProcessPostGenerateImageV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.Resolution != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), name: "\"resolution\""); - } + + } if (request.AspectRatio != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), name: "\"aspect_ratio\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NegativePrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); - } + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); - } + + } if (request.StyleReferenceImages != default) { @@ -222,7 +269,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImages != default) { @@ -239,7 +287,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImagesMask != default) { @@ -256,8 +305,19 @@ partial void ProcessPostGenerateImageV3ResponseContent( __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; } } + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -299,6 +359,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -309,6 +371,11 @@ partial void ProcessPostGenerateImageV3ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -326,6 +393,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -335,8 +404,7 @@ partial void ProcessPostGenerateImageV3ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -345,6 +413,11 @@ partial void ProcessPostGenerateImageV3ResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -361,14 +434,15 @@ partial void ProcessPostGenerateImageV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -408,6 +482,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -428,6 +504,8 @@ partial void ProcessPostGenerateImageV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -451,17 +529,16 @@ partial void ProcessPostGenerateImageV3ResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -484,17 +561,16 @@ partial void ProcessPostGenerateImageV3ResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt failed the safety check. if ((int)__response.StatusCode == 422) @@ -521,18 +597,17 @@ partial void ProcessPostGenerateImageV3ResponseContent( __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -555,17 +630,16 @@ partial void ProcessPostGenerateImageV3ResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -589,23 +663,25 @@ partial void ProcessPostGenerateImageV3ResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -619,9 +695,13 @@ partial void ProcessPostGenerateImageV3ResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -638,17 +718,15 @@ partial void ProcessPostGenerateImageV3ResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -687,6 +765,9 @@ partial void ProcessPostGenerateImageV3ResponseContent( /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -726,6 +807,13 @@ partial void ProcessPostGenerateImageV3ResponseContent( /// /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`: if the org has it on, this is ignored;
+ /// if the org has it off, setting this `true` enables detection for this request only.
+ /// Adds detection latency. Flagged images come back with `is_image_safe: false`. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -736,6 +824,7 @@ partial void ProcessPostGenerateImageV3ResponseContent( global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, @@ -746,6 +835,7 @@ partial void ProcessPostGenerateImageV3ResponseContent( global::System.Collections.Generic.IList? styleReferenceImages = default, global::System.Collections.Generic.IList? characterReferenceImages = default, global::System.Collections.Generic.IList? characterReferenceImagesMask = default, + bool? enableCopyrightDetection = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { @@ -757,6 +847,7 @@ partial void ProcessPostGenerateImageV3ResponseContent( AspectRatio = aspectRatio, RenderingSpeed = renderingSpeed, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NegativePrompt = negativePrompt, NumImages = numImages, ColorPalette = colorPalette, @@ -767,6 +858,7 @@ partial void ProcessPostGenerateImageV3ResponseContent( StyleReferenceImages = styleReferenceImages, CharacterReferenceImages = characterReferenceImages, CharacterReferenceImagesMask = characterReferenceImagesMask, + EnableCopyrightDetection = enableCopyrightDetection, }; return await PostGenerateImageV3Async( diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3Transparent.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3Transparent.g.cs index c66170c..981808d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3Transparent.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV3Transparent.g.cs @@ -47,6 +47,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
/// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
/// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. ///
/// @@ -55,6 +57,35 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( /// public async global::System.Threading.Tasks.Task PostGenerateImageV3TransparentAsync( + global::Ideogram.GenerateTransparentImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV3TransparentAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate with Ideogram 3.0 (Transparent Background)
+ /// Generates images with transparent background synchronously based on a given prompt and optional parameters using
+ /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
+ /// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
+ /// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV3TransparentAsResponseAsync( + global::Ideogram.GenerateTransparentImageRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,10 +116,11 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/generate-transparent", baseUri: HttpClient.BaseAddress); @@ -121,67 +153,87 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.UpscaleFactor != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.UpscaleFactor).HasValue ? (request.UpscaleFactor).GetValueOrDefault().ToValueString() : string.Empty), name: "\"upscale_factor\""); - } + + } if (request.AspectRatio != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), name: "\"aspect_ratio\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NegativePrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); - } + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -223,6 +275,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -233,6 +287,11 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -250,6 +309,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -259,8 +320,7 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -269,6 +329,11 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -285,14 +350,15 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -332,6 +398,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -352,6 +420,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -375,17 +445,16 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -408,17 +477,16 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt failed the safety check. if ((int)__response.StatusCode == 422) @@ -445,18 +513,17 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -479,17 +546,16 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -513,23 +579,25 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -543,9 +611,13 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -562,17 +634,15 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -589,6 +659,8 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
/// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
/// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. ///
/// @@ -615,6 +687,9 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -640,6 +715,7 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, string? customModelUri = default, @@ -654,6 +730,7 @@ partial void ProcessPostGenerateImageV3TransparentResponseContent( AspectRatio = aspectRatio, RenderingSpeed = renderingSpeed, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NegativePrompt = negativePrompt, NumImages = numImages, CustomModelUri = customModelUri, diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4.g.cs index 222fc4e..f938d54 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostGenerateImageV4ResponseContent( /// public async global::System.Threading.Tasks.Task PostGenerateImageV4Async( + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV4AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4AsResponseAsync( + global::Ideogram.GenerateImageRequestV4 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -82,10 +106,11 @@ partial void ProcessPostGenerateImageV4ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v4/generate", baseUri: HttpClient.BaseAddress); @@ -118,32 +143,75 @@ partial void ProcessPostGenerateImageV4ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), - name: "\"prompt\""); + if (request.TextPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + } + if (request.JsonPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.JsonPrompt.ToJson(JsonSerializerContext)), + name: "\"json_prompt\""); + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } - if (request.MagicPromptOption != default) + + } + if (request.MagicPromptSystemPromptConfigId != default) { __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), - name: "\"magic_prompt_option\""); - } + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -185,6 +253,8 @@ partial void ProcessPostGenerateImageV4ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -195,6 +265,11 @@ partial void ProcessPostGenerateImageV4ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -212,6 +287,8 @@ partial void ProcessPostGenerateImageV4ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -221,8 +298,7 @@ partial void ProcessPostGenerateImageV4ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -231,6 +307,11 @@ partial void ProcessPostGenerateImageV4ResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -247,14 +328,15 @@ partial void ProcessPostGenerateImageV4ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -294,6 +376,8 @@ partial void ProcessPostGenerateImageV4ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -314,6 +398,8 @@ partial void ProcessPostGenerateImageV4ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -337,17 +423,16 @@ partial void ProcessPostGenerateImageV4ResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -370,17 +455,16 @@ partial void ProcessPostGenerateImageV4ResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt failed the safety check. if ((int)__response.StatusCode == 422) @@ -407,18 +491,17 @@ partial void ProcessPostGenerateImageV4ResponseContent( __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -441,17 +524,16 @@ partial void ProcessPostGenerateImageV4ResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -475,23 +557,25 @@ partial void ProcessPostGenerateImageV4ResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -505,9 +589,13 @@ partial void ProcessPostGenerateImageV4ResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -524,17 +612,15 @@ partial void ProcessPostGenerateImageV4ResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -550,38 +636,69 @@ partial void ProcessPostGenerateImageV4ResponseContent( /// Generates images synchronously using the Ideogram 4.0 model.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// - /// - /// The text prompt for image generation. + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. /// /// /// Random seed for reproducibility. /// - /// - /// Determine if MagicPrompt should be used in generating the request or not.
- /// Example: ON + /// + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. /// /// /// A custom model URI in the format model/<model_name>/version/<version_name>.
/// When provided, the model version and style will be resolved from this URI.
/// Example: model/my-custom-model/version/0 /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostGenerateImageV4Async( - string prompt, + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, int? seed = default, - global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, string? customModelUri = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::Ideogram.GenerateImageRequestV4 { - Prompt = prompt, + TextPrompt = textPrompt, + JsonPrompt = jsonPrompt, Seed = seed, - MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, CustomModelUri = customModelUri, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, }; return await PostGenerateImageV4Async( diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Async.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Async.g.cs new file mode 100644 index 0000000..9fbf1c4 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Async.g.cs @@ -0,0 +1,765 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateImageV4AsyncSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateImageV4AsyncSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostGenerateImageV4AsyncSecurityRequirement0, + }; + partial void PreparePostGenerateImageV4AsyncArguments( + global::System.Net.Http.HttpClient httpClient, + ref string webhookUrl, + global::Ideogram.GenerateImageRequestV4 request); + partial void PreparePostGenerateImageV4AsyncRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string webhookUrl, + global::Ideogram.GenerateImageRequestV4 request); + partial void ProcessPostGenerateImageV4AsyncResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostGenerateImageV4AsyncResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4AsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV4AsyncAsResponseAsync( + webhookUrl: webhookUrl, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4AsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4AsyncArguments( + httpClient: HttpClient, + webhookUrl: ref webhookUrl, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4AsyncSecurityRequirements, + operationName: "PostGenerateImageV4AsyncAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/async/generate", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("webhook_url", webhookUrl) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(webhookUrl ?? string.Empty), + name: "\"webhook_url\""); + + if (request.TextPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + } + if (request.JsonPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.JsonPrompt.ToJson(JsonSerializerContext)), + name: "\"json_prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.CustomModelUri != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), + name: "\"custom_model_uri\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4AsyncRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookUrl: webhookUrl!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Async", + methodName: "PostGenerateImageV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Async", + methodName: "PostGenerateImageV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Async", + methodName: "PostGenerateImageV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4AsyncResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Async", + methodName: "PostGenerateImageV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Async", + methodName: "PostGenerateImageV4AsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/generate\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4AsyncResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.AsyncImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.AsyncImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI.
+ /// Example: model/my-custom-model/version/0 + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4AsyncAsync( + string webhookUrl, + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, + int? seed = default, + string? magicPromptSystemPromptConfigId = default, + string? customModelUri = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.GenerateImageRequestV4 + { + TextPrompt = textPrompt, + JsonPrompt = jsonPrompt, + Seed = seed, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + CustomModelUri = customModelUri, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + + return await PostGenerateImageV4AsyncAsync( + webhookUrl: webhookUrl, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2Im.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2Im.g.cs new file mode 100644 index 0000000..ba246f7 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2Im.g.cs @@ -0,0 +1,2024 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateImageV4Im2ImSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateImageV4Im2ImSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostGenerateImageV4Im2ImSecurityRequirement0, + }; + partial void PreparePostGenerateImageV4Im2ImArguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.GenerateImageRequestV4Im2Im request); + partial void PreparePostGenerateImageV4Im2ImRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.GenerateImageRequestV4Im2Im request); + partial void ProcessPostGenerateImageV4Im2ImResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostGenerateImageV4Im2ImResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV4Im2ImAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsResponseAsync( + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/image-to-image", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + 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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + byte[] image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = image, + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + + return await PostGenerateImageV4Im2ImAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/image-to-image", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsResponseAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/image-to-image", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2Im", + methodName: "PostGenerateImageV4Im2ImAsync", + pathTemplate: "\"/v1/ideogram-v4/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV4ImageToImage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2ImAsync.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2ImAsync.g.cs new file mode 100644 index 0000000..0c700ab --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Im2ImAsync.g.cs @@ -0,0 +1,2120 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateImageV4Im2ImAsyncSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateImageV4Im2ImAsyncSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostGenerateImageV4Im2ImAsyncSecurityRequirement0, + }; + partial void PreparePostGenerateImageV4Im2ImAsyncArguments( + global::System.Net.Http.HttpClient httpClient, + ref string webhookUrl, + global::Ideogram.GenerateImageRequestV4Im2Im request); + partial void PreparePostGenerateImageV4Im2ImAsyncRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string webhookUrl, + global::Ideogram.GenerateImageRequestV4Im2Im request); + partial void ProcessPostGenerateImageV4Im2ImAsyncResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostGenerateImageV4Im2ImAsyncResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV4Im2ImAsyncAsResponseAsync( + webhookUrl: webhookUrl, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImAsyncArguments( + httpClient: HttpClient, + webhookUrl: ref webhookUrl, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImAsyncSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsyncAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/async/image-to-image", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("webhook_url", webhookUrl) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(webhookUrl ?? string.Empty), + name: "\"webhook_url\""); + + 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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImAsyncRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookUrl: webhookUrl!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImAsyncResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImAsyncResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.AsyncImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.AsyncImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + byte[] image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = image, + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + + return await PostGenerateImageV4Im2ImAsyncAsync( + webhookUrl: webhookUrl, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImAsyncArguments( + httpClient: HttpClient, + webhookUrl: ref webhookUrl, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImAsyncSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsyncAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/async/image-to-image", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("webhook_url", webhookUrl) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(webhookUrl ?? string.Empty), + name: "\"webhook_url\""); + + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImAsyncRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookUrl: webhookUrl!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImAsyncResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImAsyncResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.AsyncImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.AsyncImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsyncAsResponseAsync( + string webhookUrl, + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.GenerateImageRequestV4Im2Im + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + MagicPromptOption = magicPromptOption, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4Im2ImAsyncArguments( + httpClient: HttpClient, + webhookUrl: ref webhookUrl, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4Im2ImAsyncSecurityRequirements, + operationName: "PostGenerateImageV4Im2ImAsyncAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/async/image-to-image", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("webhook_url", webhookUrl) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(webhookUrl ?? string.Empty), + name: "\"webhook_url\""); + + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.MagicPromptOption != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPromptOption).HasValue ? (request.MagicPromptOption).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt_option\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4Im2ImAsyncRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + webhookUrl: webhookUrl!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4Im2ImAsyncResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Im2ImAsync", + methodName: "PostGenerateImageV4Im2ImAsyncAsync", + pathTemplate: "\"/v1/ideogram-v4/async/image-to-image\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4Im2ImAsyncResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.AsyncImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.AsyncImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Stable.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Stable.g.cs new file mode 100644 index 0000000..ae286b9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostGenerateImageV4Stable.g.cs @@ -0,0 +1,678 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostGenerateImageV4StableSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostGenerateImageV4StableSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostGenerateImageV4StableSecurityRequirement0, + }; + partial void PreparePostGenerateImageV4StableArguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.GenerateImageRequestV4Stable request); + partial void PreparePostGenerateImageV4StableRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.GenerateImageRequestV4Stable request); + partial void ProcessPostGenerateImageV4StableResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostGenerateImageV4StableResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4StableAsync( + + global::Ideogram.GenerateImageRequestV4Stable request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostGenerateImageV4StableAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostGenerateImageV4StableAsResponseAsync( + + global::Ideogram.GenerateImageRequestV4Stable request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostGenerateImageV4StableArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostGenerateImageV4StableSecurityRequirements, + operationName: "PostGenerateImageV4StableAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/generate/stable", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + if (request.TextPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + } + if (request.JsonPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.JsonPrompt.ToJson(JsonSerializerContext)), + name: "\"json_prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.Version != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Version).HasValue ? (request.Version).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"version\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostGenerateImageV4StableRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Stable", + methodName: "PostGenerateImageV4StableAsync", + pathTemplate: "\"/v1/ideogram-v4/generate/stable\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Stable", + methodName: "PostGenerateImageV4StableAsync", + pathTemplate: "\"/v1/ideogram-v4/generate/stable\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Stable", + methodName: "PostGenerateImageV4StableAsync", + pathTemplate: "\"/v1/ideogram-v4/generate/stable\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostGenerateImageV4StableResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Stable", + methodName: "PostGenerateImageV4StableAsync", + pathTemplate: "\"/v1/ideogram-v4/generate/stable\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostGenerateImageV4Stable", + methodName: "PostGenerateImageV4StableAsync", + pathTemplate: "\"/v1/ideogram-v4/generate/stable\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostGenerateImageV4StableResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Optional. When supplied, the image is generated at this
+ /// resolution. When omitted, the server picks an aspect ratio
+ /// automatically based on the prompt. + /// + /// + /// Optional. Selects a specific pinned stable build. When omitted,
+ /// the default stable model URI is used. When set to `stable_may29`,
+ /// the request is routed to the May 29th stable build. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostGenerateImageV4StableAsync( + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, + int? seed = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.GenerateImageRequestV4StableVersion? version = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.GenerateImageRequestV4Stable + { + TextPrompt = textPrompt, + JsonPrompt = jsonPrompt, + Seed = seed, + Resolution = resolution, + Version = version, + }; + + return await PostGenerateImageV4StableAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostInpaintImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostInpaintImageV3.g.cs index c527a47..6b941ba 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostInpaintImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostInpaintImageV3.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostInpaintImageV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostInpaintImageV3Async( + global::Ideogram.EditImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostInpaintImageV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostInpaintImageV3AsResponseAsync( + global::Ideogram.EditImageRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostInpaintImageV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/inpaint", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostInpaintImageV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,6 +186,7 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + 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 @@ -195,72 +224,91 @@ request.Maskname is null { __contentMask.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleReferenceImages != default) { @@ -277,7 +325,8 @@ request.Maskname is null __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImages != default) { @@ -294,7 +343,8 @@ request.Maskname is null __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImagesMask != default) { @@ -311,8 +361,11 @@ request.Maskname is null __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -354,6 +407,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -364,6 +419,11 @@ request.Maskname is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -381,6 +441,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -390,8 +452,7 @@ request.Maskname is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -400,6 +461,11 @@ request.Maskname is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -416,14 +482,15 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -463,6 +530,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -483,6 +552,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -506,17 +577,16 @@ request.Maskname is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -539,17 +609,16 @@ request.Maskname is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or Initial Image failed the safety checks. if ((int)__response.StatusCode == 422) @@ -576,18 +645,17 @@ request.Maskname is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -610,17 +678,16 @@ request.Maskname is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -644,23 +711,25 @@ request.Maskname is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -674,9 +743,13 @@ request.Maskname is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -693,17 +766,15 @@ request.Maskname is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -741,6 +812,9 @@ request.Maskname is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -793,6 +867,7 @@ request.Maskname is null string maskname, string prompt, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, @@ -815,6 +890,7 @@ request.Maskname is null Maskname = maskname, Prompt = prompt, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NumImages = numImages, Seed = seed, RenderingSpeed = renderingSpeed, @@ -833,5 +909,1854 @@ request.Maskname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A photo of a cat. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostInpaintImageV3Async( + global::System.IO.Stream image, + string imagename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + mask = mask ?? throw new global::System.ArgumentNullException(nameof(mask)); + var request = new global::Ideogram.EditImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StyleType = styleType, + StylePreset = stylePreset, + CustomModelUri = customModelUri, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImagesMask = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostInpaintImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostInpaintImageV3SecurityRequirements, + operationName: "PostInpaintImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/inpaint", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __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\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.CustomModelUri != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), + name: "\"custom_model_uri\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImages != default) + { + + for (var __iCharacterReferenceImages = 0; __iCharacterReferenceImages < characterReferenceImages.Count; __iCharacterReferenceImages++) + { + var __fileNameCharacterReferenceImages = characterReferenceImagesFileNames != null && + __iCharacterReferenceImages < characterReferenceImagesFileNames.Count && + characterReferenceImagesFileNames[__iCharacterReferenceImages] != null + ? characterReferenceImagesFileNames[__iCharacterReferenceImages] + : $"file{__iCharacterReferenceImages}.bin"; + var __contentCharacterReferenceImages = new global::System.Net.Http.StreamContent(characterReferenceImages[__iCharacterReferenceImages]); + __contentCharacterReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImages) ?? 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: __contentCharacterReferenceImages, + name: "\"character_reference_images\"", + fileName: $"\"{__fileNameCharacterReferenceImages}\""); + if (__contentCharacterReferenceImages.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImagesMask != default) + { + + for (var __iCharacterReferenceImagesMask = 0; __iCharacterReferenceImagesMask < characterReferenceImagesMask.Count; __iCharacterReferenceImagesMask++) + { + var __fileNameCharacterReferenceImagesMask = characterReferenceImagesMaskFileNames != null && + __iCharacterReferenceImagesMask < characterReferenceImagesMaskFileNames.Count && + characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] != null + ? characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] + : $"file{__iCharacterReferenceImagesMask}.bin"; + var __contentCharacterReferenceImagesMask = new global::System.Net.Http.StreamContent(characterReferenceImagesMask[__iCharacterReferenceImagesMask]); + __contentCharacterReferenceImagesMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImagesMask is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImagesMask) ?? 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: __contentCharacterReferenceImagesMask, + name: "\"character_reference_images_mask\"", + fileName: $"\"{__fileNameCharacterReferenceImagesMask}\""); + if (__contentCharacterReferenceImagesMask.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostInpaintImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostInpaintImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostInpaintImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A photo of a cat. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostInpaintImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + mask = mask ?? throw new global::System.ArgumentNullException(nameof(mask)); + var request = new global::Ideogram.EditImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StyleType = styleType, + StylePreset = stylePreset, + CustomModelUri = customModelUri, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImagesMask = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostInpaintImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostInpaintImageV3SecurityRequirements, + operationName: "PostInpaintImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/inpaint", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __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\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.CustomModelUri != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), + name: "\"custom_model_uri\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImages != default) + { + + for (var __iCharacterReferenceImages = 0; __iCharacterReferenceImages < characterReferenceImages.Count; __iCharacterReferenceImages++) + { + var __fileNameCharacterReferenceImages = characterReferenceImagesFileNames != null && + __iCharacterReferenceImages < characterReferenceImagesFileNames.Count && + characterReferenceImagesFileNames[__iCharacterReferenceImages] != null + ? characterReferenceImagesFileNames[__iCharacterReferenceImages] + : $"file{__iCharacterReferenceImages}.bin"; + var __contentCharacterReferenceImages = new global::System.Net.Http.StreamContent(characterReferenceImages[__iCharacterReferenceImages]); + __contentCharacterReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImages) ?? 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: __contentCharacterReferenceImages, + name: "\"character_reference_images\"", + fileName: $"\"{__fileNameCharacterReferenceImages}\""); + if (__contentCharacterReferenceImages.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImagesMask != default) + { + + for (var __iCharacterReferenceImagesMask = 0; __iCharacterReferenceImagesMask < characterReferenceImagesMask.Count; __iCharacterReferenceImagesMask++) + { + var __fileNameCharacterReferenceImagesMask = characterReferenceImagesMaskFileNames != null && + __iCharacterReferenceImagesMask < characterReferenceImagesMaskFileNames.Count && + characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] != null + ? characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] + : $"file{__iCharacterReferenceImagesMask}.bin"; + var __contentCharacterReferenceImagesMask = new global::System.Net.Http.StreamContent(characterReferenceImagesMask[__iCharacterReferenceImagesMask]); + __contentCharacterReferenceImagesMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImagesMask is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImagesMask) ?? 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: __contentCharacterReferenceImagesMask, + name: "\"character_reference_images_mask\"", + fileName: $"\"{__fileNameCharacterReferenceImagesMask}\""); + if (__contentCharacterReferenceImagesMask.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostInpaintImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostInpaintImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostInpaintImageV3", + methodName: "PostInpaintImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/inpaint\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostInpaintImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeDesignV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeDesignV3.g.cs index 02f4868..56c4c09 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeDesignV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeDesignV3.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostLayerizeDesignV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostLayerizeDesignV3Async( + global::Ideogram.LayerizeDesignRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostLayerizeDesignV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostLayerizeDesignV3AsResponseAsync( + global::Ideogram.LayerizeDesignRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostLayerizeDesignV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/layerize-design", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostLayerizeDesignV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentFlatGraphicImage = new global::System.Net.Http.ByteArrayContent(request.FlatGraphicImage ?? global::System.Array.Empty()); __contentFlatGraphicImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,20 +186,23 @@ request.FlatGraphicImagename is null { __contentFlatGraphicImage.Headers.ContentDisposition.FileNameStar = null; } + if (request.Prompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.FontFileH1 != default) { @@ -212,14 +243,16 @@ request.FontFileH1name is null { __contentFontFileH1.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameH1 != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameH1 ?? string.Empty), name: "\"font_name_h1\""); - } + + } if (request.FontFileH2 != default) { @@ -260,14 +293,16 @@ request.FontFileH2name is null { __contentFontFileH2.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameH2 != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameH2 ?? string.Empty), name: "\"font_name_h2\""); - } + + } if (request.FontFileBody != default) { @@ -308,14 +343,16 @@ request.FontFileBodyname is null { __contentFontFileBody.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameBody != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameBody ?? string.Empty), name: "\"font_name_body\""); - } + + } if (request.FontFileSmall != default) { @@ -356,14 +393,16 @@ request.FontFileSmallname is null { __contentFontFileSmall.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.FontNameSmall != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.FontNameSmall ?? string.Empty), name: "\"font_name_small\""); - } + + } if (request.ReferenceAssetImages != default) { @@ -380,8 +419,11 @@ request.FontFileSmallname is null __contentReferenceAssetImages.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -423,6 +465,8 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -433,6 +477,11 @@ request.FontFileSmallname is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -450,6 +499,8 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -459,8 +510,7 @@ request.FontFileSmallname is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -469,6 +519,11 @@ request.FontFileSmallname is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -485,14 +540,15 @@ request.FontFileSmallname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -532,6 +588,8 @@ request.FontFileSmallname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -552,6 +610,8 @@ request.FontFileSmallname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -575,17 +635,16 @@ request.FontFileSmallname is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -608,17 +667,16 @@ request.FontFileSmallname is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -641,17 +699,16 @@ request.FontFileSmallname is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -675,23 +732,25 @@ request.FontFileSmallname is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -705,9 +764,13 @@ request.FontFileSmallname is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -724,17 +787,15 @@ request.FontFileSmallname is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -855,5 +916,1722 @@ request.FontFileSmallname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// An optional prompt to describe the image. If not provided, a prompt will be auto-generated from the image via captioning. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Font name from the available font library for H1 text. Ignored if font_file_h1 is provided.
+ /// Example: Ubuntu-Bold.ttf + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Font name from the available font library for H2 text. Ignored if font_file_h2 is provided. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Font name from the available font library for body text. Ignored if font_file_body is provided. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Font name from the available font library for small text. Ignored if font_file_small is provided. + /// + /// + /// A set of asset images (e.g., logos, icons) to use as references for detection and replacement (maximum 10 images). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'reference_asset_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostLayerizeDesignV3Async( + global::System.IO.Stream flatGraphicImage, + string flatGraphicImagename, + string? prompt = default, + int? seed = default, + global::System.IO.Stream? fontFileH1 = default, + string? fontFileH1name = default, + string? fontNameH1 = default, + global::System.IO.Stream? fontFileH2 = default, + string? fontFileH2name = default, + string? fontNameH2 = default, + global::System.IO.Stream? fontFileBody = default, + string? fontFileBodyname = default, + string? fontNameBody = default, + global::System.IO.Stream? fontFileSmall = default, + string? fontFileSmallname = default, + string? fontNameSmall = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImages = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + flatGraphicImage = flatGraphicImage ?? throw new global::System.ArgumentNullException(nameof(flatGraphicImage)); + var request = new global::Ideogram.LayerizeDesignRequestV3 + { + FlatGraphicImage = global::System.Array.Empty(), + FlatGraphicImagename = flatGraphicImagename, + Prompt = prompt, + Seed = seed, + FontFileH1 = global::System.Array.Empty(), + FontFileH1name = fontFileH1name, + FontNameH1 = fontNameH1, + FontFileH2 = global::System.Array.Empty(), + FontFileH2name = fontFileH2name, + FontNameH2 = fontNameH2, + FontFileBody = global::System.Array.Empty(), + FontFileBodyname = fontFileBodyname, + FontNameBody = fontNameBody, + FontFileSmall = global::System.Array.Empty(), + FontFileSmallname = fontFileSmallname, + FontNameSmall = fontNameSmall, + ReferenceAssetImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostLayerizeDesignV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostLayerizeDesignV3SecurityRequirements, + operationName: "PostLayerizeDesignV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/layerize-design", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentFlatGraphicImage = new global::System.Net.Http.StreamContent(flatGraphicImage); + __contentFlatGraphicImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FlatGraphicImagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FlatGraphicImagename) ?? 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: __contentFlatGraphicImage, + name: "\"flat_graphic_image\"", + fileName: request.FlatGraphicImagename != null ? $"\"{request.FlatGraphicImagename}\"" : string.Empty); + if (__contentFlatGraphicImage.Headers.ContentDisposition != null) + { + __contentFlatGraphicImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (fontFileH1 != default) + { + + var __contentFontFileH1 = new global::System.Net.Http.StreamContent(fontFileH1); + __contentFontFileH1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileH1name is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileH1name) ?? 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: __contentFontFileH1, + name: "\"font_file_h1\"", + fileName: request.FontFileH1name != null ? $"\"{request.FontFileH1name}\"" : string.Empty); + if (__contentFontFileH1.Headers.ContentDisposition != null) + { + __contentFontFileH1.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameH1 != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameH1 ?? string.Empty), + name: "\"font_name_h1\""); + + } + if (fontFileH2 != default) + { + + var __contentFontFileH2 = new global::System.Net.Http.StreamContent(fontFileH2); + __contentFontFileH2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileH2name is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileH2name) ?? 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: __contentFontFileH2, + name: "\"font_file_h2\"", + fileName: request.FontFileH2name != null ? $"\"{request.FontFileH2name}\"" : string.Empty); + if (__contentFontFileH2.Headers.ContentDisposition != null) + { + __contentFontFileH2.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameH2 != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameH2 ?? string.Empty), + name: "\"font_name_h2\""); + + } + if (fontFileBody != default) + { + + var __contentFontFileBody = new global::System.Net.Http.StreamContent(fontFileBody); + __contentFontFileBody.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileBodyname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileBodyname) ?? 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: __contentFontFileBody, + name: "\"font_file_body\"", + fileName: request.FontFileBodyname != null ? $"\"{request.FontFileBodyname}\"" : string.Empty); + if (__contentFontFileBody.Headers.ContentDisposition != null) + { + __contentFontFileBody.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameBody != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameBody ?? string.Empty), + name: "\"font_name_body\""); + + } + if (fontFileSmall != default) + { + + var __contentFontFileSmall = new global::System.Net.Http.StreamContent(fontFileSmall); + __contentFontFileSmall.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileSmallname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileSmallname) ?? 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: __contentFontFileSmall, + name: "\"font_file_small\"", + fileName: request.FontFileSmallname != null ? $"\"{request.FontFileSmallname}\"" : string.Empty); + if (__contentFontFileSmall.Headers.ContentDisposition != null) + { + __contentFontFileSmall.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameSmall != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameSmall ?? string.Empty), + name: "\"font_name_small\""); + + } + if (referenceAssetImages != default) + { + + for (var __iReferenceAssetImages = 0; __iReferenceAssetImages < referenceAssetImages.Count; __iReferenceAssetImages++) + { + var __fileNameReferenceAssetImages = referenceAssetImagesFileNames != null && + __iReferenceAssetImages < referenceAssetImagesFileNames.Count && + referenceAssetImagesFileNames[__iReferenceAssetImages] != null + ? referenceAssetImagesFileNames[__iReferenceAssetImages] + : $"file{__iReferenceAssetImages}.bin"; + var __contentReferenceAssetImages = new global::System.Net.Http.StreamContent(referenceAssetImages[__iReferenceAssetImages]); + __contentReferenceAssetImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameReferenceAssetImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameReferenceAssetImages) ?? 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: __contentReferenceAssetImages, + name: "\"reference_asset_images\"", + fileName: $"\"{__fileNameReferenceAssetImages}\""); + if (__contentReferenceAssetImages.Headers.ContentDisposition != null) + { + __contentReferenceAssetImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostLayerizeDesignV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostLayerizeDesignV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostLayerizeDesignV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// An optional prompt to describe the image. If not provided, a prompt will be auto-generated from the image via captioning. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Font name from the available font library for H1 text. Ignored if font_file_h1 is provided.
+ /// Example: Ubuntu-Bold.ttf + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Font name from the available font library for H2 text. Ignored if font_file_h2 is provided. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Font name from the available font library for body text. Ignored if font_file_body is provided. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Font name from the available font library for small text. Ignored if font_file_small is provided. + /// + /// + /// A set of asset images (e.g., logos, icons) to use as references for detection and replacement (maximum 10 images). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'reference_asset_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostLayerizeDesignV3AsResponseAsync( + global::System.IO.Stream flatGraphicImage, + string flatGraphicImagename, + string? prompt = default, + int? seed = default, + global::System.IO.Stream? fontFileH1 = default, + string? fontFileH1name = default, + string? fontNameH1 = default, + global::System.IO.Stream? fontFileH2 = default, + string? fontFileH2name = default, + string? fontNameH2 = default, + global::System.IO.Stream? fontFileBody = default, + string? fontFileBodyname = default, + string? fontNameBody = default, + global::System.IO.Stream? fontFileSmall = default, + string? fontFileSmallname = default, + string? fontNameSmall = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImages = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + flatGraphicImage = flatGraphicImage ?? throw new global::System.ArgumentNullException(nameof(flatGraphicImage)); + var request = new global::Ideogram.LayerizeDesignRequestV3 + { + FlatGraphicImage = global::System.Array.Empty(), + FlatGraphicImagename = flatGraphicImagename, + Prompt = prompt, + Seed = seed, + FontFileH1 = global::System.Array.Empty(), + FontFileH1name = fontFileH1name, + FontNameH1 = fontNameH1, + FontFileH2 = global::System.Array.Empty(), + FontFileH2name = fontFileH2name, + FontNameH2 = fontNameH2, + FontFileBody = global::System.Array.Empty(), + FontFileBodyname = fontFileBodyname, + FontNameBody = fontNameBody, + FontFileSmall = global::System.Array.Empty(), + FontFileSmallname = fontFileSmallname, + FontNameSmall = fontNameSmall, + ReferenceAssetImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostLayerizeDesignV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostLayerizeDesignV3SecurityRequirements, + operationName: "PostLayerizeDesignV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/layerize-design", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentFlatGraphicImage = new global::System.Net.Http.StreamContent(flatGraphicImage); + __contentFlatGraphicImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FlatGraphicImagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FlatGraphicImagename) ?? 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: __contentFlatGraphicImage, + name: "\"flat_graphic_image\"", + fileName: request.FlatGraphicImagename != null ? $"\"{request.FlatGraphicImagename}\"" : string.Empty); + if (__contentFlatGraphicImage.Headers.ContentDisposition != null) + { + __contentFlatGraphicImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (fontFileH1 != default) + { + + var __contentFontFileH1 = new global::System.Net.Http.StreamContent(fontFileH1); + __contentFontFileH1.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileH1name is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileH1name) ?? 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: __contentFontFileH1, + name: "\"font_file_h1\"", + fileName: request.FontFileH1name != null ? $"\"{request.FontFileH1name}\"" : string.Empty); + if (__contentFontFileH1.Headers.ContentDisposition != null) + { + __contentFontFileH1.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameH1 != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameH1 ?? string.Empty), + name: "\"font_name_h1\""); + + } + if (fontFileH2 != default) + { + + var __contentFontFileH2 = new global::System.Net.Http.StreamContent(fontFileH2); + __contentFontFileH2.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileH2name is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileH2name) ?? 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: __contentFontFileH2, + name: "\"font_file_h2\"", + fileName: request.FontFileH2name != null ? $"\"{request.FontFileH2name}\"" : string.Empty); + if (__contentFontFileH2.Headers.ContentDisposition != null) + { + __contentFontFileH2.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameH2 != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameH2 ?? string.Empty), + name: "\"font_name_h2\""); + + } + if (fontFileBody != default) + { + + var __contentFontFileBody = new global::System.Net.Http.StreamContent(fontFileBody); + __contentFontFileBody.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileBodyname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileBodyname) ?? 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: __contentFontFileBody, + name: "\"font_file_body\"", + fileName: request.FontFileBodyname != null ? $"\"{request.FontFileBodyname}\"" : string.Empty); + if (__contentFontFileBody.Headers.ContentDisposition != null) + { + __contentFontFileBody.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameBody != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameBody ?? string.Empty), + name: "\"font_name_body\""); + + } + if (fontFileSmall != default) + { + + var __contentFontFileSmall = new global::System.Net.Http.StreamContent(fontFileSmall); + __contentFontFileSmall.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.FontFileSmallname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.FontFileSmallname) ?? 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: __contentFontFileSmall, + name: "\"font_file_small\"", + fileName: request.FontFileSmallname != null ? $"\"{request.FontFileSmallname}\"" : string.Empty); + if (__contentFontFileSmall.Headers.ContentDisposition != null) + { + __contentFontFileSmall.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.FontNameSmall != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.FontNameSmall ?? string.Empty), + name: "\"font_name_small\""); + + } + if (referenceAssetImages != default) + { + + for (var __iReferenceAssetImages = 0; __iReferenceAssetImages < referenceAssetImages.Count; __iReferenceAssetImages++) + { + var __fileNameReferenceAssetImages = referenceAssetImagesFileNames != null && + __iReferenceAssetImages < referenceAssetImagesFileNames.Count && + referenceAssetImagesFileNames[__iReferenceAssetImages] != null + ? referenceAssetImagesFileNames[__iReferenceAssetImages] + : $"file{__iReferenceAssetImages}.bin"; + var __contentReferenceAssetImages = new global::System.Net.Http.StreamContent(referenceAssetImages[__iReferenceAssetImages]); + __contentReferenceAssetImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameReferenceAssetImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameReferenceAssetImages) ?? 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: __contentReferenceAssetImages, + name: "\"reference_asset_images\"", + fileName: $"\"{__fileNameReferenceAssetImages}\""); + if (__contentReferenceAssetImages.Headers.ContentDisposition != null) + { + __contentReferenceAssetImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostLayerizeDesignV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostLayerizeDesignV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeDesignV3", + methodName: "PostLayerizeDesignV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-design\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostLayerizeDesignV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.LayeredImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.LayeredImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeTextV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeTextV3.g.cs index 43359a9..ddef91e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeTextV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostLayerizeTextV3.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostLayerizeTextV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostLayerizeTextV3Async( + global::Ideogram.LayerizeTextRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostLayerizeTextV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostLayerizeTextV3AsResponseAsync( + global::Ideogram.LayerizeTextRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostLayerizeTextV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/layerize-text", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostLayerizeTextV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,21 +186,26 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + if (request.Prompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -214,6 +247,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -224,6 +259,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -241,6 +281,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -250,8 +292,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -260,6 +301,11 @@ request.Imagename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -276,14 +322,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -323,6 +370,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -343,6 +392,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -366,17 +417,16 @@ request.Imagename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -399,17 +449,16 @@ request.Imagename is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -432,17 +481,16 @@ request.Imagename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -466,23 +514,25 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.LayerizeTextResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.LayerizeTextResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -496,9 +546,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.LayerizeTextResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.LayerizeTextResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -515,17 +569,15 @@ request.Imagename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -580,5 +632,1082 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// An optional text description of the image. If not provided, a description will be auto-generated from the image. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostLayerizeTextV3Async( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.LayerizeTextRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + }; + PrepareArguments( + client: HttpClient); + PreparePostLayerizeTextV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostLayerizeTextV3SecurityRequirements, + operationName: "PostLayerizeTextV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/layerize-text", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostLayerizeTextV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostLayerizeTextV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostLayerizeTextV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.LayerizeTextResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.LayerizeTextResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// An optional text description of the image. If not provided, a description will be auto-generated from the image. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostLayerizeTextV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.LayerizeTextRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + Seed = seed, + }; + PrepareArguments( + client: HttpClient); + PreparePostLayerizeTextV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostLayerizeTextV3SecurityRequirements, + operationName: "PostLayerizeTextV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/layerize-text", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostLayerizeTextV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostLayerizeTextV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostLayerizeTextV3", + methodName: "PostLayerizeTextV3Async", + pathTemplate: "\"/v1/ideogram-v3/layerize-text\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostLayerizeTextV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.LayerizeTextResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.LayerizeTextResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImage.g.cs index 41aeea2..98fd7a4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImage.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostReframeImageResponseContent( /// public async global::System.Threading.Tasks.Task PostReframeImageAsync( + global::Ideogram.ReframeImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostReframeImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReframeImageAsResponseAsync( + global::Ideogram.ReframeImageRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -82,10 +106,11 @@ partial void ProcessPostReframeImageResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/reframe", baseUri: HttpClient.BaseAddress); @@ -118,6 +143,7 @@ partial void ProcessPostReframeImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -156,34 +182,42 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), name: "\"resolution\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), name: "\"model\""); + if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -225,6 +259,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -235,6 +271,11 @@ request.ImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -252,6 +293,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -261,8 +304,7 @@ request.ImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -271,6 +313,11 @@ request.ImageFilename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -287,14 +334,15 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -334,6 +382,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -354,6 +404,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -377,17 +429,16 @@ request.ImageFilename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -410,17 +461,16 @@ request.ImageFilename is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or Image failed the safety checks. if ((int)__response.StatusCode == 422) @@ -447,18 +497,17 @@ request.ImageFilename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -481,17 +530,16 @@ request.ImageFilename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -515,23 +563,25 @@ request.ImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -545,9 +595,13 @@ request.ImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -564,17 +618,15 @@ request.ImageFilename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -647,5 +699,1224 @@ request.ImageFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// (For model_version for 2.0 only, cannot be used in conjunction with aspect_ratio) The resolution to use for image generation, represented in width x height. If not specified, defaults to using aspect_ratio.
+ /// Example: RESOLUTION_1024_1024 + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostReframeImageAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.Resolution resolution, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.ReframeImageRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + Resolution = resolution, + Model = model, + NumImages = numImages, + Seed = seed, + StyleType = styleType, + }; + PrepareArguments( + client: HttpClient); + PreparePostReframeImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReframeImageSecurityRequirements, + operationName: "PostReframeImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/reframe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), + name: "\"resolution\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), + name: "\"model\""); + + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReframeImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReframeImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReframeImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// (For model_version for 2.0 only, cannot be used in conjunction with aspect_ratio) The resolution to use for image generation, represented in width x height. If not specified, defaults to using aspect_ratio.
+ /// Example: RESOLUTION_1024_1024 + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReframeImageAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.Resolution resolution, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.ReframeImageRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + Resolution = resolution, + Model = model, + NumImages = numImages, + Seed = seed, + StyleType = styleType, + }; + PrepareArguments( + client: HttpClient); + PreparePostReframeImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReframeImageSecurityRequirements, + operationName: "PostReframeImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/reframe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), + name: "\"resolution\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToValueString()), + name: "\"model\""); + + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReframeImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReframeImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImage", + methodName: "PostReframeImageAsync", + pathTemplate: "\"/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReframeImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImageV3.g.cs index eb523a9..560cc28 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReframeImageV3.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostReframeImageV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostReframeImageV3Async( + global::Ideogram.ReframeImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostReframeImageV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReframeImageV3AsResponseAsync( + global::Ideogram.ReframeImageRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -82,10 +106,11 @@ partial void ProcessPostReframeImageV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/reframe", baseUri: HttpClient.BaseAddress); @@ -118,6 +143,7 @@ partial void ProcessPostReframeImageV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -156,51 +182,59 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), name: "\"resolution\""); + if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleReferenceImages != default) { @@ -217,8 +251,11 @@ request.Imagename is null __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -260,6 +297,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -270,6 +309,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -287,6 +331,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -296,8 +342,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -306,6 +351,11 @@ request.Imagename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -322,14 +372,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -369,6 +420,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -389,6 +442,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -412,17 +467,16 @@ request.Imagename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -445,17 +499,16 @@ request.Imagename is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or Image failed the safety checks. if ((int)__response.StatusCode == 422) @@ -482,18 +535,17 @@ request.Imagename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -516,17 +568,16 @@ request.Imagename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -550,23 +601,25 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -580,9 +633,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -599,17 +656,15 @@ request.Imagename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -697,5 +752,1402 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostReframeImageV3Async( + global::System.IO.Stream image, + string imagename, + global::Ideogram.ResolutionV3 resolution, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.ReframeImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Resolution = resolution, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StylePreset = stylePreset, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostReframeImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReframeImageV3SecurityRequirements, + operationName: "PostReframeImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/reframe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), + name: "\"resolution\""); + + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReframeImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReframeImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReframeImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReframeImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.ResolutionV3 resolution, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.ReframeImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Resolution = resolution, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StylePreset = stylePreset, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostReframeImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReframeImageV3SecurityRequirements, + operationName: "PostReframeImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/reframe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Resolution.ToValueString()), + name: "\"resolution\""); + + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReframeImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReframeImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReframeImageV3", + methodName: "PostReframeImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/reframe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReframeImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImage.g.cs index 6bd933f..c980bd0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImage.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostRemixImageResponseContent( /// public async global::System.Threading.Tasks.Task PostRemixImageAsync( + global::Ideogram.RemixImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostRemixImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageAsResponseAsync( + global::Ideogram.RemixImageRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostRemixImageResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/remix", baseUri: HttpClient.BaseAddress); @@ -120,10 +147,12 @@ partial void ProcessPostRemixImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), name: "\"image_request\""); + var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( request.ImageFilename is null @@ -161,7 +190,9 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -203,6 +234,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -213,6 +246,11 @@ request.ImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -230,6 +268,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -239,8 +279,7 @@ request.ImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -249,6 +288,11 @@ request.ImageFilename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -265,14 +309,15 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -312,6 +357,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -332,6 +379,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -355,17 +404,16 @@ request.ImageFilename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -388,17 +436,16 @@ request.ImageFilename is null __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or provided image failed safety check. if ((int)__response.StatusCode == 422) @@ -425,18 +472,17 @@ request.ImageFilename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -459,17 +505,16 @@ request.ImageFilename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -493,23 +538,25 @@ request.ImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -523,9 +570,13 @@ request.ImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -542,17 +593,15 @@ request.ImageFilename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -602,5 +651,1120 @@ request.ImageFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to generate a new image using a provided image and a prompt.
+ /// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"ON","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","image_weight":50} + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemixImageAsync( + global::Ideogram.InitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.RemixImageRequest + { + ImageRequest = imageRequest, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageSecurityRequirements, + operationName: "PostRemixImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), + name: "\"image_request\""); + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to generate a new image using a provided image and a prompt.
+ /// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"ON","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","image_weight":50} + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageAsResponseAsync( + global::Ideogram.InitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.RemixImageRequest + { + ImageRequest = imageRequest, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageSecurityRequirements, + operationName: "PostRemixImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), + name: "\"image_request\""); + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImage", + methodName: "PostRemixImageAsync", + pathTemplate: "\"/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV3.g.cs index 2dc9bdf..9d36250 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV3.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostRemixImageV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostRemixImageV3Async( + global::Ideogram.RemixImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostRemixImageV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageV3AsResponseAsync( + global::Ideogram.RemixImageRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostRemixImageV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/remix", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostRemixImageV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,100 +186,123 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.ImageWeight != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"image_weight\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.Resolution != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), name: "\"resolution\""); - } + + } if (request.AspectRatio != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), name: "\"aspect_ratio\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NegativePrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), name: "\"negative_prompt\""); - } + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.CustomModelUri != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), name: "\"custom_model_uri\""); - } + + } if (request.StyleReferenceImages != default) { @@ -268,7 +319,8 @@ request.Imagename is null __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImages != default) { @@ -285,7 +337,8 @@ request.Imagename is null __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.CharacterReferenceImagesMask != default) { @@ -302,8 +355,11 @@ request.Imagename is null __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -345,6 +401,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -355,6 +413,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -372,6 +435,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -381,8 +446,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -391,6 +455,11 @@ request.Imagename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -407,14 +476,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -454,6 +524,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -474,6 +546,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -497,17 +571,16 @@ request.Imagename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -530,17 +603,16 @@ request.Imagename is null __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or provided image failed safety check. if ((int)__response.StatusCode == 422) @@ -567,18 +639,17 @@ request.Imagename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -601,17 +672,16 @@ request.Imagename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -635,23 +705,25 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -665,9 +737,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -684,17 +760,15 @@ request.Imagename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -745,6 +819,9 @@ request.Imagename is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -797,6 +874,7 @@ request.Imagename is null global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, @@ -821,6 +899,7 @@ request.Imagename is null AspectRatio = aspectRatio, RenderingSpeed = renderingSpeed, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NegativePrompt = negativePrompt, NumImages = numImages, ColorPalette = colorPalette, @@ -838,5 +917,1868 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt to use to generate the image.
+ /// Example: A photo of a cat + /// + /// + /// Default Value: 50
+ /// Example: 50 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The aspect ratio to use for image generation, which determines the image's resolution. Cannot be used in conjunction with resolution. Defaults to 1x1. + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// Description of what to exclude from an image. Descriptions in the prompt take precedence
+ /// to descriptions in the negative prompt.
+ /// Example: brush strokes, painting + /// + /// + /// Number of images to generate.
+ /// Default Value: 1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemixImageV3Async( + global::System.IO.Stream image, + string imagename, + string prompt, + int? imageWeight = default, + int? seed = default, + global::Ideogram.ResolutionV3? resolution = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + string? negativePrompt = default, + int? numImages = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemixImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + ImageWeight = imageWeight, + Seed = seed, + Resolution = resolution, + AspectRatio = aspectRatio, + RenderingSpeed = renderingSpeed, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NegativePrompt = negativePrompt, + NumImages = numImages, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleType = styleType, + StylePreset = stylePreset, + CustomModelUri = customModelUri, + StyleReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImagesMask = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageV3SecurityRequirements, + operationName: "PostRemixImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.ImageWeight != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"image_weight\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.AspectRatio != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"aspect_ratio\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NegativePrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), + name: "\"negative_prompt\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.CustomModelUri != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), + name: "\"custom_model_uri\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImages != default) + { + + for (var __iCharacterReferenceImages = 0; __iCharacterReferenceImages < characterReferenceImages.Count; __iCharacterReferenceImages++) + { + var __fileNameCharacterReferenceImages = characterReferenceImagesFileNames != null && + __iCharacterReferenceImages < characterReferenceImagesFileNames.Count && + characterReferenceImagesFileNames[__iCharacterReferenceImages] != null + ? characterReferenceImagesFileNames[__iCharacterReferenceImages] + : $"file{__iCharacterReferenceImages}.bin"; + var __contentCharacterReferenceImages = new global::System.Net.Http.StreamContent(characterReferenceImages[__iCharacterReferenceImages]); + __contentCharacterReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImages) ?? 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: __contentCharacterReferenceImages, + name: "\"character_reference_images\"", + fileName: $"\"{__fileNameCharacterReferenceImages}\""); + if (__contentCharacterReferenceImages.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImagesMask != default) + { + + for (var __iCharacterReferenceImagesMask = 0; __iCharacterReferenceImagesMask < characterReferenceImagesMask.Count; __iCharacterReferenceImagesMask++) + { + var __fileNameCharacterReferenceImagesMask = characterReferenceImagesMaskFileNames != null && + __iCharacterReferenceImagesMask < characterReferenceImagesMaskFileNames.Count && + characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] != null + ? characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] + : $"file{__iCharacterReferenceImagesMask}.bin"; + var __contentCharacterReferenceImagesMask = new global::System.Net.Http.StreamContent(characterReferenceImagesMask[__iCharacterReferenceImagesMask]); + __contentCharacterReferenceImagesMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImagesMask is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImagesMask) ?? 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: __contentCharacterReferenceImagesMask, + name: "\"character_reference_images_mask\"", + fileName: $"\"{__fileNameCharacterReferenceImagesMask}\""); + if (__contentCharacterReferenceImagesMask.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt to use to generate the image.
+ /// Example: A photo of a cat + /// + /// + /// Default Value: 50
+ /// Example: 50 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The aspect ratio to use for image generation, which determines the image's resolution. Cannot be used in conjunction with resolution. Defaults to 1x1. + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// Description of what to exclude from an image. Descriptions in the prompt take precedence
+ /// to descriptions in the negative prompt.
+ /// Example: brush strokes, painting + /// + /// + /// Number of images to generate.
+ /// Default Value: 1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string prompt, + int? imageWeight = default, + int? seed = default, + global::Ideogram.ResolutionV3? resolution = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + string? negativePrompt = default, + int? numImages = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemixImageRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + ImageWeight = imageWeight, + Seed = seed, + Resolution = resolution, + AspectRatio = aspectRatio, + RenderingSpeed = renderingSpeed, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NegativePrompt = negativePrompt, + NumImages = numImages, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleType = styleType, + StylePreset = stylePreset, + CustomModelUri = customModelUri, + StyleReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImages = new global::System.Collections.Generic.List(), + CharacterReferenceImagesMask = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageV3SecurityRequirements, + operationName: "PostRemixImageV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.ImageWeight != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"image_weight\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.AspectRatio != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"aspect_ratio\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NegativePrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.NegativePrompt ?? string.Empty), + name: "\"negative_prompt\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.CustomModelUri != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.CustomModelUri ?? string.Empty), + name: "\"custom_model_uri\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImages != default) + { + + for (var __iCharacterReferenceImages = 0; __iCharacterReferenceImages < characterReferenceImages.Count; __iCharacterReferenceImages++) + { + var __fileNameCharacterReferenceImages = characterReferenceImagesFileNames != null && + __iCharacterReferenceImages < characterReferenceImagesFileNames.Count && + characterReferenceImagesFileNames[__iCharacterReferenceImages] != null + ? characterReferenceImagesFileNames[__iCharacterReferenceImages] + : $"file{__iCharacterReferenceImages}.bin"; + var __contentCharacterReferenceImages = new global::System.Net.Http.StreamContent(characterReferenceImages[__iCharacterReferenceImages]); + __contentCharacterReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImages) ?? 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: __contentCharacterReferenceImages, + name: "\"character_reference_images\"", + fileName: $"\"{__fileNameCharacterReferenceImages}\""); + if (__contentCharacterReferenceImages.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + if (characterReferenceImagesMask != default) + { + + for (var __iCharacterReferenceImagesMask = 0; __iCharacterReferenceImagesMask < characterReferenceImagesMask.Count; __iCharacterReferenceImagesMask++) + { + var __fileNameCharacterReferenceImagesMask = characterReferenceImagesMaskFileNames != null && + __iCharacterReferenceImagesMask < characterReferenceImagesMaskFileNames.Count && + characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] != null + ? characterReferenceImagesMaskFileNames[__iCharacterReferenceImagesMask] + : $"file{__iCharacterReferenceImagesMask}.bin"; + var __contentCharacterReferenceImagesMask = new global::System.Net.Http.StreamContent(characterReferenceImagesMask[__iCharacterReferenceImagesMask]); + __contentCharacterReferenceImagesMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameCharacterReferenceImagesMask is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameCharacterReferenceImagesMask) ?? 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: __contentCharacterReferenceImagesMask, + name: "\"character_reference_images_mask\"", + fileName: $"\"{__fileNameCharacterReferenceImagesMask}\""); + if (__contentCharacterReferenceImagesMask.Headers.ContentDisposition != null) + { + __contentCharacterReferenceImagesMask.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV3", + methodName: "PostRemixImageV3Async", + pathTemplate: "\"/v1/ideogram-v3/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV4.g.cs new file mode 100644 index 0000000..5b19068 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemixImageV4.g.cs @@ -0,0 +1,1944 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostRemixImageV4SecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostRemixImageV4SecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostRemixImageV4SecurityRequirement0, + }; + partial void PreparePostRemixImageV4Arguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.RemixImageRequestV4 request); + partial void PreparePostRemixImageV4Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.RemixImageRequestV4 request); + partial void ProcessPostRemixImageV4Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostRemixImageV4ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemixImageV4Async( + + global::Ideogram.RemixImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostRemixImageV4AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageV4AsResponseAsync( + + global::Ideogram.RemixImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostRemixImageV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageV4SecurityRequirements, + operationName: "PostRemixImageV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + 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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + if (request.ImageWeight != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"image_weight\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemixImageV4Async( + byte[] image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.RemixImageRequestV4 + { + Image = image, + Imagename = imagename, + TextPrompt = textPrompt, + ImageWeight = imageWeight, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + + return await PostRemixImageV4Async( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemixImageV4Async( + global::System.IO.Stream image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemixImageRequestV4 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + TextPrompt = textPrompt, + ImageWeight = imageWeight, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageV4SecurityRequirements, + operationName: "PostRemixImageV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + if (request.ImageWeight != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"image_weight\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemixImageV4AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemixImageRequestV4 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + TextPrompt = textPrompt, + ImageWeight = imageWeight, + Resolution = resolution, + RenderingSpeed = renderingSpeed, + EnableCopyrightDetection = enableCopyrightDetection, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemixImageV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemixImageV4SecurityRequirements, + operationName: "PostRemixImageV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/remix", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.TextPrompt ?? string.Empty), + name: "\"text_prompt\""); + + if (request.ImageWeight != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.ImageWeight, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"image_weight\""); + + } + if (request.Resolution != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"resolution\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.EnableCopyrightDetection != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.EnableCopyrightDetection, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"enable_copyright_detection\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemixImageV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemixImageV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemixImageV4", + methodName: "PostRemixImageV4Async", + pathTemplate: "\"/v1/ideogram-v4/remix\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemixImageV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemoveBackground.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemoveBackground.g.cs new file mode 100644 index 0000000..d59dcbd --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostRemoveBackground.g.cs @@ -0,0 +1,1745 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class GenerateClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostRemoveBackgroundSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostRemoveBackgroundSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostRemoveBackgroundSecurityRequirement0, + }; + partial void PreparePostRemoveBackgroundArguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.RemoveBackgroundRequest request); + partial void PreparePostRemoveBackgroundRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.RemoveBackgroundRequest request); + partial void ProcessPostRemoveBackgroundResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostRemoveBackgroundResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + + global::Ideogram.RemoveBackgroundRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostRemoveBackgroundAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemoveBackgroundAsResponseAsync( + + global::Ideogram.RemoveBackgroundRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostRemoveBackgroundArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemoveBackgroundSecurityRequirements, + operationName: "PostRemoveBackgroundAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/remove-background", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + 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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemoveBackgroundRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemoveBackgroundResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Initial image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemoveBackgroundResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.RemoveBackgroundResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.RemoveBackgroundResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + byte[] image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.RemoveBackgroundRequest + { + Image = image, + Imagename = imagename, + }; + + return await PostRemoveBackgroundAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemoveBackgroundRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemoveBackgroundArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemoveBackgroundSecurityRequirements, + operationName: "PostRemoveBackgroundAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/remove-background", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemoveBackgroundRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemoveBackgroundResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Initial image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemoveBackgroundResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.RemoveBackgroundResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.RemoveBackgroundResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostRemoveBackgroundAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.RemoveBackgroundRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + }; + PrepareArguments( + client: HttpClient); + PreparePostRemoveBackgroundArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostRemoveBackgroundSecurityRequirements, + operationName: "PostRemoveBackgroundAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/remove-background", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostRemoveBackgroundRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostRemoveBackgroundResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostRemoveBackground", + methodName: "PostRemoveBackgroundAsync", + pathTemplate: "\"/v1/remove-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Initial image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostRemoveBackgroundResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.RemoveBackgroundResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.RemoveBackgroundResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReplaceBackgroundV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReplaceBackgroundV3.g.cs index 1cb24fd..7261954 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReplaceBackgroundV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostReplaceBackgroundV3.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostReplaceBackgroundV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostReplaceBackgroundV3Async( + global::Ideogram.ReplaceBackgroundRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostReplaceBackgroundV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReplaceBackgroundV3AsResponseAsync( + global::Ideogram.ReplaceBackgroundRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostReplaceBackgroundV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/replace-background", baseUri: HttpClient.BaseAddress); @@ -120,6 +147,7 @@ partial void ProcessPostReplaceBackgroundV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -158,58 +186,75 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); - } + + } if (request.ColorPalette != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), name: "\"color_palette\""); - } + + } if (request.StyleCodes != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), name: "\"style_codes\""); - } + + } if (request.StyleReferenceImages != default) { @@ -226,8 +271,11 @@ request.Imagename is null __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -269,6 +317,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -279,6 +329,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -296,6 +351,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -305,8 +362,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -315,6 +371,11 @@ request.Imagename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -331,14 +392,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -378,6 +440,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -398,6 +462,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -421,17 +487,16 @@ request.Imagename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -454,17 +519,16 @@ request.Imagename is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or Initial Image failed the safety checks. if ((int)__response.StatusCode == 422) @@ -491,18 +555,17 @@ request.Imagename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -525,17 +588,16 @@ request.Imagename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -559,23 +621,25 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -589,9 +653,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -608,17 +676,15 @@ request.Imagename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -650,6 +716,9 @@ request.Imagename is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -684,6 +753,7 @@ request.Imagename is null string imagename, string prompt, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, @@ -700,6 +770,7 @@ request.Imagename is null Imagename = imagename, Prompt = prompt, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NumImages = numImages, Seed = seed, RenderingSpeed = renderingSpeed, @@ -714,5 +785,1460 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired new background.
+ /// Example: A vibrant cityscape at night. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostReplaceBackgroundV3Async( + global::System.IO.Stream image, + string imagename, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.ReplaceBackgroundRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StylePreset = stylePreset, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostReplaceBackgroundV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReplaceBackgroundV3SecurityRequirements, + operationName: "PostReplaceBackgroundV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/replace-background", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReplaceBackgroundV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReplaceBackgroundV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReplaceBackgroundV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired new background.
+ /// Example: A vibrant cityscape at night. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostReplaceBackgroundV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::Ideogram.ReplaceBackgroundRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StylePreset = stylePreset, + ColorPalette = colorPalette, + StyleCodes = styleCodes, + StyleReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostReplaceBackgroundV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostReplaceBackgroundV3SecurityRequirements, + operationName: "PostReplaceBackgroundV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/replace-background", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + if (request.ColorPalette != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ColorPalette.ToString() ?? string.Empty), + name: "\"color_palette\""); + + } + if (request.StyleCodes != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.StyleCodes, x => x))}]"), + name: "\"style_codes\""); + + } + if (styleReferenceImages != default) + { + + for (var __iStyleReferenceImages = 0; __iStyleReferenceImages < styleReferenceImages.Count; __iStyleReferenceImages++) + { + var __fileNameStyleReferenceImages = styleReferenceImagesFileNames != null && + __iStyleReferenceImages < styleReferenceImagesFileNames.Count && + styleReferenceImagesFileNames[__iStyleReferenceImages] != null + ? styleReferenceImagesFileNames[__iStyleReferenceImages] + : $"file{__iStyleReferenceImages}.bin"; + var __contentStyleReferenceImages = new global::System.Net.Http.StreamContent(styleReferenceImages[__iStyleReferenceImages]); + __contentStyleReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameStyleReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameStyleReferenceImages) ?? 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: __contentStyleReferenceImages, + name: "\"style_reference_images\"", + fileName: $"\"{__fileNameStyleReferenceImages}\""); + if (__contentStyleReferenceImages.Headers.ContentDisposition != null) + { + __contentStyleReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostReplaceBackgroundV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostReplaceBackgroundV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostReplaceBackgroundV3", + methodName: "PostReplaceBackgroundV3Async", + pathTemplate: "\"/v1/ideogram-v3/replace-background\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or Initial Image failed the safety checks. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostReplaceBackgroundV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostTryOnV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostTryOnV3.g.cs index 554a4e8..743fc9f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostTryOnV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostTryOnV3.g.cs @@ -55,6 +55,33 @@ partial void ProcessPostTryOnV3ResponseContent( /// public async global::System.Threading.Tasks.Task PostTryOnV3Async( + global::Ideogram.TryOnRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostTryOnV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostTryOnV3AsResponseAsync( + global::Ideogram.TryOnRequestV3 request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,10 +112,11 @@ partial void ProcessPostTryOnV3ResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/try-on", baseUri: HttpClient.BaseAddress); @@ -121,6 +149,7 @@ partial void ProcessPostTryOnV3ResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -159,54 +188,70 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + if (request.Prompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.RenderingSpeed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), name: "\"rendering_speed\""); - } + + } if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.StylePreset != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_preset\""); + } for (var __iProductReferenceImages = 0; __iProductReferenceImages < request.ProductReferenceImages.Count; __iProductReferenceImages++) { @@ -221,7 +266,9 @@ request.Imagename is null __contentProductReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -263,6 +310,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -273,6 +322,11 @@ request.Imagename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -290,6 +344,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -299,8 +355,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -309,6 +364,11 @@ request.Imagename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -325,14 +385,15 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -372,6 +433,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -392,6 +455,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -415,17 +480,16 @@ request.Imagename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -448,17 +512,16 @@ request.Imagename is null __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or provided image failed safety check, or clothing segmentation failed. if ((int)__response.StatusCode == 422) @@ -485,18 +548,17 @@ request.Imagename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -519,17 +581,16 @@ request.Imagename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -553,23 +614,25 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -583,9 +646,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -602,17 +669,15 @@ request.Imagename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -646,6 +711,9 @@ request.Imagename is null /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -679,6 +747,7 @@ request.Imagename is null global::System.Collections.Generic.IList productReferenceImages, string? prompt = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, @@ -693,6 +762,7 @@ request.Imagename is null Imagename = imagename, Prompt = prompt, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, NumImages = numImages, Seed = seed, RenderingSpeed = renderingSpeed, @@ -706,5 +776,1440 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired clothing change. Defaults to "Person wearing this piece of clothing" if omitted or empty.
+ /// Default Value: Person wearing this piece of clothing
+ /// Example: Change his shirt to a pink shirt + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// An image to use as the product reference for the try-on (exactly 1 image required). The image should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'product_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostTryOnV3Async( + global::System.IO.Stream image, + string imagename, + global::System.Collections.Generic.IReadOnlyList productReferenceImages, + string? prompt = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::System.Collections.Generic.IReadOnlyList? productReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + productReferenceImages = productReferenceImages ?? throw new global::System.ArgumentNullException(nameof(productReferenceImages)); + var request = new global::Ideogram.TryOnRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StyleType = styleType, + StylePreset = stylePreset, + ProductReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostTryOnV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostTryOnV3SecurityRequirements, + operationName: "PostTryOnV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/try-on", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + for (var __iProductReferenceImages = 0; __iProductReferenceImages < productReferenceImages.Count; __iProductReferenceImages++) + { + var __fileNameProductReferenceImages = productReferenceImagesFileNames != null && + __iProductReferenceImages < productReferenceImagesFileNames.Count && + productReferenceImagesFileNames[__iProductReferenceImages] != null + ? productReferenceImagesFileNames[__iProductReferenceImages] + : $"file{__iProductReferenceImages}.bin"; + var __contentProductReferenceImages = new global::System.Net.Http.StreamContent(productReferenceImages[__iProductReferenceImages]); + __contentProductReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameProductReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameProductReferenceImages) ?? 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: __contentProductReferenceImages, + name: "\"product_reference_images\"", + fileName: $"\"{__fileNameProductReferenceImages}\""); + if (__contentProductReferenceImages.Headers.ContentDisposition != null) + { + __contentProductReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostTryOnV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostTryOnV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check, or clothing segmentation failed. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostTryOnV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired clothing change. Defaults to "Person wearing this piece of clothing" if omitted or empty.
+ /// Default Value: Person wearing this piece of clothing
+ /// Example: Change his shirt to a pink shirt + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// An image to use as the product reference for the try-on (exactly 1 image required). The image should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'product_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostTryOnV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::System.Collections.Generic.IReadOnlyList productReferenceImages, + string? prompt = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::System.Collections.Generic.IReadOnlyList? productReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + productReferenceImages = productReferenceImages ?? throw new global::System.ArgumentNullException(nameof(productReferenceImages)); + var request = new global::Ideogram.TryOnRequestV3 + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Prompt = prompt, + MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, + NumImages = numImages, + Seed = seed, + RenderingSpeed = renderingSpeed, + StyleType = styleType, + StylePreset = stylePreset, + ProductReferenceImages = new global::System.Collections.Generic.List(), + }; + PrepareArguments( + client: HttpClient); + PreparePostTryOnV3Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostTryOnV3SecurityRequirements, + operationName: "PostTryOnV3Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v3/try-on", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImage = new global::System.Net.Http.StreamContent(image); + __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\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } + if (request.MagicPrompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"magic_prompt\""); + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } + if (request.NumImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"num_images\""); + + } + if (request.Seed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"seed\""); + + } + if (request.RenderingSpeed != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.RenderingSpeed).HasValue ? (request.RenderingSpeed).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"rendering_speed\""); + + } + if (request.StyleType != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_type\""); + + } + if (request.StylePreset != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.StylePreset).HasValue ? (request.StylePreset).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"style_preset\""); + + } + for (var __iProductReferenceImages = 0; __iProductReferenceImages < productReferenceImages.Count; __iProductReferenceImages++) + { + var __fileNameProductReferenceImages = productReferenceImagesFileNames != null && + __iProductReferenceImages < productReferenceImagesFileNames.Count && + productReferenceImagesFileNames[__iProductReferenceImages] != null + ? productReferenceImagesFileNames[__iProductReferenceImages] + : $"file{__iProductReferenceImages}.bin"; + var __contentProductReferenceImages = new global::System.Net.Http.StreamContent(productReferenceImages[__iProductReferenceImages]); + __contentProductReferenceImages.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + __fileNameProductReferenceImages is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(__fileNameProductReferenceImages) ?? 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: __contentProductReferenceImages, + name: "\"product_reference_images\"", + fileName: $"\"{__fileNameProductReferenceImages}\""); + if (__contentProductReferenceImages.Headers.ContentDisposition != null) + { + __contentProductReferenceImages.Headers.ContentDisposition.FileNameStar = null; + } + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostTryOnV3Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostTryOnV3Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostTryOnV3", + methodName: "PostTryOnV3Async", + pathTemplate: "\"/v1/ideogram-v3/try-on\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check, or clothing segmentation failed. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostTryOnV3ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ImageGenerationResponseV3.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ImageGenerationResponseV3.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostUpscaleImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostUpscaleImage.g.cs index ddd4349..cbf8e2b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostUpscaleImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostUpscaleImage.g.cs @@ -53,6 +53,31 @@ partial void ProcessPostUpscaleImageResponseContent( /// public async global::System.Threading.Tasks.Task PostUpscaleImageAsync( + global::Ideogram.UpscaleImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostUpscaleImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostUpscaleImageAsResponseAsync( + global::Ideogram.UpscaleImageRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -83,10 +108,11 @@ partial void ProcessPostUpscaleImageResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/upscale", baseUri: HttpClient.BaseAddress); @@ -119,10 +145,12 @@ partial void ProcessPostUpscaleImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), name: "\"image_request\""); + var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( request.ImageFilename is null @@ -160,7 +188,9 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -202,6 +232,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -212,6 +244,11 @@ request.ImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -229,6 +266,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -238,8 +277,7 @@ request.ImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -248,6 +286,11 @@ request.ImageFilename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -264,14 +307,15 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -311,6 +355,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -331,6 +377,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -354,17 +402,16 @@ request.ImageFilename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -387,17 +434,16 @@ request.ImageFilename is null __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or provided image failed safety check. if ((int)__response.StatusCode == 422) @@ -424,18 +470,17 @@ request.ImageFilename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -458,17 +503,16 @@ request.ImageFilename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -492,23 +536,25 @@ request.ImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -522,9 +568,13 @@ request.ImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -541,17 +591,15 @@ request.ImageFilename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -599,5 +647,1116 @@ request.ImageFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to upscale a provided image with the help of an optional prompt. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostUpscaleImageAsync( + global::Ideogram.UpscaleInitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.UpscaleImageRequest + { + ImageRequest = imageRequest, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + }; + PrepareArguments( + client: HttpClient); + PreparePostUpscaleImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostUpscaleImageSecurityRequirements, + operationName: "PostUpscaleImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/upscale", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), + name: "\"image_request\""); + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostUpscaleImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostUpscaleImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostUpscaleImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to upscale a provided image with the help of an optional prompt. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostUpscaleImageAsResponseAsync( + global::Ideogram.UpscaleInitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.UpscaleImageRequest + { + ImageRequest = imageRequest, + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + }; + PrepareArguments( + client: HttpClient); + PreparePostUpscaleImageArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostUpscaleImageSecurityRequirements, + operationName: "PostUpscaleImageAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/upscale", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ImageRequest.ToJson(JsonSerializerContext)), + name: "\"image_request\""); + + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostUpscaleImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostUpscaleImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostUpscaleImage", + methodName: "PostUpscaleImageAsync", + pathTemplate: "\"/upscale\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Prompt or provided image failed safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.GenerateImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.GenerateImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostUpscaleImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GenerateImageResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GenerateImageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostV1EditImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostV1EditImage.g.cs index d2c2301..c18a8bf 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostV1EditImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.PostV1EditImage.g.cs @@ -54,6 +54,32 @@ partial void ProcessPostV1EditImageResponseContent( /// public async global::System.Threading.Tasks.Task PostV1EditImageAsync( + global::Ideogram.V1EditImagesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostV1EditImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Edit images with a prompt
+ /// Edit one or more images using a text prompt. Provide images via file upload
+ /// or Ideogram image URLs, and describe the desired edit in your prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostV1EditImageAsResponseAsync( + global::Ideogram.V1EditImagesRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,10 +110,11 @@ partial void ProcessPostV1EditImageResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/edit", baseUri: HttpClient.BaseAddress); @@ -120,10 +147,12 @@ partial void ProcessPostV1EditImageResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Images != default) { @@ -140,57 +169,75 @@ partial void ProcessPostV1EditImageResponseContent( __contentImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.ImageUrls != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.ImageUrls, x => x))}]"), name: "\"image_urls\""); - } + + } if (request.NumImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.NumImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"num_images\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.MagicPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.MagicPrompt).HasValue ? (request.MagicPrompt).GetValueOrDefault().ToValueString() : string.Empty), name: "\"magic_prompt\""); - } + + } + if (request.MagicPromptSystemPromptConfigId != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.MagicPromptSystemPromptConfigId ?? string.Empty), + name: "\"magic_prompt_system_prompt_config_id\""); + + } if (request.Resolution != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Resolution).HasValue ? (request.Resolution).GetValueOrDefault().ToValueString() : string.Empty), name: "\"resolution\""); - } + + } if (request.AspectRatio != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), name: "\"aspect_ratio\""); - } + + } if (request.TransparentBackground != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.TransparentBackground, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"transparent_background\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -232,6 +279,8 @@ partial void ProcessPostV1EditImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -242,6 +291,11 @@ partial void ProcessPostV1EditImageResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -259,6 +313,8 @@ partial void ProcessPostV1EditImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -268,8 +324,7 @@ partial void ProcessPostV1EditImageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -278,6 +333,11 @@ partial void ProcessPostV1EditImageResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -294,14 +354,15 @@ partial void ProcessPostV1EditImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -341,6 +402,8 @@ partial void ProcessPostV1EditImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -361,6 +424,8 @@ partial void ProcessPostV1EditImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -384,17 +449,16 @@ partial void ProcessPostV1EditImageResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -417,17 +481,16 @@ partial void ProcessPostV1EditImageResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 402) @@ -450,17 +513,16 @@ partial void ProcessPostV1EditImageResponseContent( __exception_402 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Prompt or provided image failed safety checks. if ((int)__response.StatusCode == 422) @@ -487,18 +549,17 @@ partial void ProcessPostV1EditImageResponseContent( __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -521,17 +582,16 @@ partial void ProcessPostV1EditImageResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 503) @@ -554,17 +614,16 @@ partial void ProcessPostV1EditImageResponseContent( __exception_503 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_503, - statusCode: __response.StatusCode) - { - ResponseBody = __content_503, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -588,23 +647,25 @@ partial void ProcessPostV1EditImageResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.V1EditImagesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.V1EditImagesResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -618,9 +679,13 @@ partial void ProcessPostV1EditImageResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.V1EditImagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.V1EditImagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -637,17 +702,15 @@ partial void ProcessPostV1EditImageResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -687,6 +750,9 @@ partial void ProcessPostV1EditImageResponseContent( /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The resolutions supported for Ideogram 3.0.
/// Example: 1280x800 @@ -708,6 +774,7 @@ partial void ProcessPostV1EditImageResponseContent( int? numImages = default, int? seed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, global::Ideogram.ResolutionV3? resolution = default, global::Ideogram.AspectRatioV3? aspectRatio = default, bool? transparentBackground = default, @@ -722,6 +789,7 @@ partial void ProcessPostV1EditImageResponseContent( NumImages = numImages, Seed = seed, MagicPrompt = magicPrompt, + MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId, Resolution = resolution, AspectRatio = aspectRatio, TransparentBackground = transparentBackground, diff --git a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.g.cs index 6a99377..5650d3a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.GenerateClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.GenerateClient.g.cs @@ -62,6 +62,27 @@ public GenerateClient( { } + /// + /// Creates a new instance of the GenerateClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public GenerateClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the GenerateClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public GenerateClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public GenerateClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.IBatchClient.GetMaybeBatchResults.g.cs b/src/libs/Ideogram/Generated/Ideogram.IBatchClient.GetMaybeBatchResults.g.cs index 91af1fc..6df74be 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IBatchClient.GetMaybeBatchResults.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IBatchClient.GetMaybeBatchResults.g.cs @@ -16,5 +16,17 @@ public partial interface IBatchClient string jobId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get Batch Magic Prompt Job Results if available.
+ /// Gets the results of a batch magic prompt job if available. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetMaybeBatchResultsAsResponseAsync( + string jobId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IBatchClient.PostBatch.g.cs b/src/libs/Ideogram/Generated/Ideogram.IBatchClient.PostBatch.g.cs index 4b211a8..26096eb 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IBatchClient.PostBatch.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IBatchClient.PostBatch.g.cs @@ -23,6 +23,20 @@ public partial interface IBatchClient /// Runs automated evaluation of multiple LLM models and system prompts for magic prompt generation.
/// Generates images using large batches of user prompt inputs. Internal use only (feature flagged). ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostBatchAsResponseAsync( + + global::Ideogram.InternalBatchRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Initiate Batch Magic Prompt Evalution
+ /// Runs automated evaluation of multiple LLM models and system prompts for magic prompt generation.
+ /// Generates images using large batches of user prompt inputs. Internal use only (feature flagged). + ///
/// /// The prompts to enhance with a magic prompt.
/// Example: [a cat, a dog] @@ -32,7 +46,7 @@ public partial interface IBatchClient /// Example: MAGIC_PROMPT_NO_TEXT /// /// - /// Example: {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// Example: {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.CreateDataset.g.cs b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.CreateDataset.g.cs index 740c181..69ab609 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.CreateDataset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.CreateDataset.g.cs @@ -21,6 +21,19 @@ public partial interface IDatasetsClient /// Create a new dataset
/// Creates a new dataset /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateDatasetAsResponseAsync( + + global::Ideogram.CreateDatasetRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new dataset
+ /// Creates a new dataset + ///
/// /// Name of the dataset. /// diff --git a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.GetDataset.g.cs b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.GetDataset.g.cs index 45d893e..f15d31c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.GetDataset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.GetDataset.g.cs @@ -16,5 +16,17 @@ public partial interface IDatasetsClient string datasetId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a dataset
+ /// Returns a dataset by ID, including the total number of files and a list of each file's name and size in bytes. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetDatasetAsResponseAsync( + string datasetId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.ListDatasets.g.cs b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.ListDatasets.g.cs index 6c3f221..3a78f7d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.ListDatasets.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.ListDatasets.g.cs @@ -14,5 +14,15 @@ public partial interface IDatasetsClient global::System.Threading.Tasks.Task ListDatasetsAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List datasets
+ /// Lists all datasets for the authenticated user + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListDatasetsAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.TrainDatasetModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.TrainDatasetModel.g.cs index d66ddee..96fad43 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.TrainDatasetModel.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.TrainDatasetModel.g.cs @@ -24,6 +24,21 @@ public partial interface IDatasetsClient /// Start training a custom model from a dataset. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> TrainDatasetModelAsResponseAsync( + string datasetId, + + global::Ideogram.TrainDatasetModelRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Train a model from a dataset
+ /// Start training a custom model from a dataset. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. + ///
+ /// /// /// Name for the trained model. Must be 5-30 characters, alphanumeric with spaces and hyphens allowed.
/// Example: my-custom-model diff --git a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.UploadDatasetAssets.g.cs b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.UploadDatasetAssets.g.cs index bfcdb84..2bf18c9 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.UploadDatasetAssets.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IDatasetsClient.UploadDatasetAssets.g.cs @@ -24,6 +24,21 @@ public partial interface IDatasetsClient /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadDatasetAssetsAsResponseAsync( + string datasetId, + + global::Ideogram.UploadDatasetAssetsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// /// /// Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional! /// @@ -35,5 +50,46 @@ public partial interface IDatasetsClient global::System.Collections.Generic.IList files, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// + /// + /// Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional! + /// + /// + /// Optional file names to use for the multipart 'files' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UploadDatasetAssetsAsync( + string datasetId, + global::System.Collections.Generic.IReadOnlyList files, + global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload assets to a dataset
+ /// Upload image assets to a dataset for model training. Accepts individual images (JPEG, PNG, WebP), optional .txt caption sidecar files, and/or ZIP archives containing images and captions. A dataset can contain up to 100 images. + ///
+ /// + /// + /// Image files (JPEG, PNG, WebP), .txt caption sidecar files, and/or ZIP archives containing images and captions. Caption .txt files are matched to images by filename stem (e.g. sunset.txt provides the caption for sunset.jpg). Captions are optional! + /// + /// + /// Optional file names to use for the multipart 'files' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadDatasetAssetsAsResponseAsync( + string datasetId, + global::System.Collections.Generic.IReadOnlyList files, + global::System.Collections.Generic.IReadOnlyList? filesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.GetGeneration.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.GetGeneration.g.cs new file mode 100644 index 0000000..84fa321 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.GetGeneration.g.cs @@ -0,0 +1,32 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Poll a generation
+ /// Retrieves the current status of an asynchronous generation, and its results once complete. Use the `generation_id` returned by the async generation endpoint. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetGenerationAsync( + string generationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Poll a generation
+ /// Retrieves the current status of an asynchronous generation, and its results once complete. Use the `generation_id` returned by the async generation endpoint. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetGenerationAsResponseAsync( + string generationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImage.g.cs index 04264b8..9fc6e68 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImage.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostEditImageAsResponseAsync( + + global::Ideogram.EditImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -52,6 +68,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -75,6 +94,136 @@ public partial interface IGenerateClient string prompt, global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset. + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostEditImageAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Edit (legacy)
+ /// Edit a given image synchronously using the provided mask. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style type can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset. + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostEditImageAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.StyleType? styleType = default, diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImageV3.g.cs deleted file mode 100644 index 04369d8..0000000 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostEditImageV3.g.cs +++ /dev/null @@ -1,116 +0,0 @@ -#nullable enable - -namespace Ideogram -{ - public partial interface IGenerateClient - { - /// - /// Edit with Ideogram 3.0
- /// Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
- /// should be edited, while the prompt and chosen style can further guide the edit.
- /// Supported image formats include JPEG, PNG, and WebP.
- /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. - ///
- /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task PostEditImageV3Async( - - global::Ideogram.EditImageRequestV3 request, - global::Ideogram.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); - /// - /// Edit with Ideogram 3.0
- /// Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
- /// should be edited, while the prompt and chosen style can further guide the edit.
- /// Supported image formats include JPEG, PNG, and WebP.
- /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. - ///
- /// - /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. - /// - /// - /// The prompt used to describe the edited result.
- /// Example: A photo of a cat. - /// - /// - /// Determine if MagicPrompt should be used in generating the request or not.
- /// Example: ON - /// - /// - /// The number of images to generate.
- /// Default Value: 1 - /// - /// - /// Random seed. Set for reproducible generation.
- /// Example: 12345 - /// - /// - /// The rendering speed to use.
- /// Default Value: DEFAULT - /// - /// - /// The style type to generate with.
- /// Default Value: GENERAL
- /// Example: GENERAL - /// - /// - /// A predefined style preset that applies a specific artistic style to the generated image.
- /// Example: BRIGHT_ART - /// - /// - /// A custom model URI in the format model/<model_name>/version/<version_name>.
- /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
- /// Example: model/my-custom-model/version/1 - /// - /// - /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. - /// - /// - /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
- /// Example: [AAFF5733, 0133FF57, DE3357FF] - /// - /// - /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. - /// - /// - /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. - /// - /// - /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. - /// - /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. - /// The token to cancel the operation with - /// - global::System.Threading.Tasks.Task PostEditImageV3Async( - byte[] image, - string imagename, - byte[] mask, - string maskname, - string prompt, - global::Ideogram.MagicPromptOption? magicPrompt = default, - int? numImages = default, - int? seed = default, - global::Ideogram.RenderingSpeed? renderingSpeed = default, - global::Ideogram.StyleTypeV3? styleType = default, - global::Ideogram.StylePresetV3? stylePreset = default, - string? customModelUri = default, - global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, - global::System.Collections.Generic.IList? styleCodes = default, - global::System.Collections.Generic.IList? styleReferenceImages = default, - global::System.Collections.Generic.IList? characterReferenceImages = default, - global::System.Collections.Generic.IList? characterReferenceImagesMask = default, - global::Ideogram.AutoSDKRequestOptions? requestOptions = default, - global::System.Threading.CancellationToken cancellationToken = default); - } -} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV3.g.cs index 2e84a7d..cc2e0ae 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV3.g.cs @@ -25,6 +25,21 @@ public partial interface IGenerateClient /// The response includes the generated image URL along with detected text layers (with font, size, color, position) and image asset layers.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateDesignV3AsResponseAsync( + + global::Ideogram.GenerateDesignRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate a design from a text prompt with text detection and correction
+ /// Generates a design synchronously from a text prompt using the Ideogram 3.0 model, then detects and corrects text layers within the generated image.
+ /// The response includes the generated image URL along with detected text layers (with font, size, color, position) and image asset layers.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The prompt to use to generate the design.
/// Example: A birthday card saying 'Happy Birthday' @@ -48,6 +63,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from a design. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -131,6 +149,7 @@ public partial interface IGenerateClient global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4.g.cs new file mode 100644 index 0000000..9b006c4 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4.g.cs @@ -0,0 +1,105 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateDesignV4Async( + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateDesignV4AsResponseAsync( + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate an editable design with Ideogram 4.0 HTML
+ /// Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.
+ /// Optionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The text prompt for editable design generation. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. + /// + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + /// + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateDesignV4Async( + string prompt, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4Layout? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::System.Collections.Generic.IList? inspirationReferenceImages = default, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? inspirationReferenceModel = default, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? artifactGenerationModel = default, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? layout2imageVariant = default, + global::Ideogram.GenerateDesignRequestV4ResponseType? responseType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4Async.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4Async.g.cs new file mode 100644 index 0000000..23c93e3 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateDesignV4Async.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateDesignV4AsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateDesignV4AsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateDesignRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate an editable V4 HTML design asynchronously via webhook
+ /// Accepts an Ideogram 4.0 HTML design request for asynchronous processing and
+ /// returns immediately with a request_id. The generated design is POSTed to the
+ /// supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The text prompt for editable design generation. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. + /// + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + /// + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateDesignV4AsyncAsync( + string webhookUrl, + string prompt, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4Layout? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::System.Collections.Generic.IList? inspirationReferenceImages = default, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? inspirationReferenceModel = default, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? artifactGenerationModel = default, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? layout2imageVariant = default, + global::Ideogram.GenerateDesignRequestV4ResponseType? responseType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImage.g.cs index 31fcd0b..e5c59b1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImage.g.cs @@ -23,6 +23,20 @@ public partial interface IGenerateClient /// Generates images synchronously based on a given prompt and optional parameters.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageAsResponseAsync( + + global::Ideogram.GenerateImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate (legacy)
+ /// Generates images synchronously based on a given prompt and optional parameters.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"AUTO","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset."} /// diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3.g.cs index 7215309..b931f80 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3.g.cs @@ -23,6 +23,20 @@ public partial interface IGenerateClient /// Generates images synchronously based on a given prompt and optional parameters using the Ideogram 3.0 model.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV3AsResponseAsync( + + global::Ideogram.GenerateImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 3.0
+ /// Generates images synchronously based on a given prompt and optional parameters using the Ideogram 3.0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The prompt to use to generate the image.
/// Example: A photo of a cat @@ -46,6 +60,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -85,6 +102,13 @@ public partial interface IGenerateClient /// /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`: if the org has it on, this is ignored;
+ /// if the org has it off, setting this `true` enables detection for this request only.
+ /// Adds detection latency. Flagged images come back with `is_image_safe: false`. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// @@ -95,6 +119,7 @@ public partial interface IGenerateClient global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, @@ -105,6 +130,7 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? styleReferenceImages = default, global::System.Collections.Generic.IList? characterReferenceImages = default, global::System.Collections.Generic.IList? characterReferenceImagesMask = default, + bool? enableCopyrightDetection = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3Transparent.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3Transparent.g.cs index 2d63ebb..ba98611 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3Transparent.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV3Transparent.g.cs @@ -10,6 +10,8 @@ public partial interface IGenerateClient /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
/// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
/// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// /// @@ -27,6 +29,27 @@ public partial interface IGenerateClient /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
/// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
/// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV3TransparentAsResponseAsync( + + global::Ideogram.GenerateTransparentImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 3.0 (Transparent Background)
+ /// Generates images with transparent background synchronously based on a given prompt and optional parameters using
+ /// the Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio
+ /// to allow best results with upscaler. The selected resolution is written to the response, not the upscaled final
+ /// resolution.
+ /// `rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.
+ /// Use `TURBO`, `DEFAULT`, or `QUALITY` instead.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. ///
/// @@ -53,6 +76,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -78,6 +104,7 @@ public partial interface IGenerateClient global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, string? customModelUri = default, diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4.g.cs index 69d0b50..c6361a7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4.g.cs @@ -23,29 +23,70 @@ public partial interface IGenerateClient /// Generates images synchronously using the Ideogram 4.0 model.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// - /// - /// The text prompt for image generation. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4AsResponseAsync( + + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. /// /// /// Random seed for reproducibility. /// - /// - /// Determine if MagicPrompt should be used in generating the request or not.
- /// Example: ON + /// + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. /// /// /// A custom model URI in the format model/<model_name>/version/<version_name>.
/// When provided, the model version and style will be resolved from this URI.
/// Example: model/my-custom-model/version/0 /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostGenerateImageV4Async( - string prompt, + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, int? seed = default, - global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, string? customModelUri = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Async.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Async.g.cs new file mode 100644 index 0000000..09f545c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Async.g.cs @@ -0,0 +1,135 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4AsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4AsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 generation request for asynchronous processing and
+ /// returns immediately with a generation_id. The generated images are POSTed to
+ /// the supplied `webhook_url` once ready, in a payload that mirrors the
+ /// synchronous response with an added generation_id for correlation. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI.
+ /// Example: model/my-custom-model/version/0 + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4AsyncAsync( + string webhookUrl, + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, + int? seed = default, + string? magicPromptSystemPromptConfigId = default, + string? customModelUri = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2Im.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2Im.g.cs new file mode 100644 index 0000000..ccb0ec3 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2Im.g.cs @@ -0,0 +1,196 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsResponseAsync( + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + byte[] image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0
+ /// Generates images synchronously using the Ideogram 4.0 model with an initial image as input.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsResponseAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2ImAsync.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2ImAsync.g.cs new file mode 100644 index 0000000..2a74002 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Im2ImAsync.g.cs @@ -0,0 +1,261 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsyncAsResponseAsync( + string webhookUrl, + + global::Ideogram.GenerateImageRequestV4Im2Im request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + byte[] image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4Im2ImAsyncAsync( + string webhookUrl, + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Image-to-image with Ideogram 4.0 asynchronously via webhook
+ /// Accepts an Ideogram 4.0 image-to-image request for asynchronous processing
+ /// and returns immediately with a request_id. The generated images are POSTed
+ /// to the supplied `webhook_url` once ready. + ///
+ /// + /// HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a
+ /// JSON POST to this URL once all images for the request have finished
+ /// generating. The body mirrors the synchronous generate response:
+ /// `request_id`, `created`, and a `data` array
+ /// containing every generated image (`url`, `prompt`, `resolution`, `seed`,
+ /// `is_image_safe`). Each delivery is signed with Ed25519 and verifiable
+ /// against the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;
+ /// private and loopback hosts and the cloud metadata service are rejected.
+ /// Example: https://api.example.com/webhooks/ideogram + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4Im2ImAsyncAsResponseAsync( + string webhookUrl, + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.MagicPromptOption? magicPromptOption = default, + string? magicPromptSystemPromptConfigId = default, + global::Ideogram.ResolutionV4ImageToImage? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Stable.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Stable.g.cs new file mode 100644 index 0000000..337fc7b --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostGenerateImageV4Stable.g.cs @@ -0,0 +1,88 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4StableAsync( + + global::Ideogram.GenerateImageRequestV4Stable request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostGenerateImageV4StableAsResponseAsync( + + global::Ideogram.GenerateImageRequestV4Stable request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate with Ideogram 4.0 (stable model)
+ /// Generates images synchronously using a pinned stable build of the
+ /// Ideogram 4.0 model. This endpoint is intentionally minimal: it accepts
+ /// only a prompt (and optional seed), pins the underlying model URI, and
+ /// lets the server pick the output resolution automatically.
+ /// Images links are available for a limited period of time; if you would
+ /// like to keep the image, you must download it. + ///
+ /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Optional. When supplied, the image is generated at this
+ /// resolution. When omitted, the server picks an aspect ratio
+ /// automatically based on the prompt. + /// + /// + /// Optional. Selects a specific pinned stable build. When omitted,
+ /// the default stable model URI is used. When set to `stable_may29`,
+ /// the request is routed to the May 29th stable build. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostGenerateImageV4StableAsync( + string? textPrompt = default, + global::Ideogram.V4JsonPrompt? jsonPrompt = default, + int? seed = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.GenerateImageRequestV4StableVersion? version = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostInpaintImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostInpaintImageV3.g.cs index a916b00..98bfa3d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostInpaintImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostInpaintImageV3.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostInpaintImageV3AsResponseAsync( + + global::Ideogram.EditImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -47,6 +63,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -99,6 +118,7 @@ public partial interface IGenerateClient string maskname, string prompt, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, @@ -112,5 +132,222 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? characterReferenceImagesMask = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A photo of a cat. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostInpaintImageV3Async( + global::System.IO.Stream image, + string imagename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Inpaint with Ideogram 3.0
+ /// Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image
+ /// should be edited, while the prompt and chosen style can further guide the edit.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being edited (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// A black and white image of the same size as the image being edited (max size 10MB). Black regions in the mask should match up with the regions of the image that you would like to edit; only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt used to describe the edited result.
+ /// Example: A photo of a cat. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostInpaintImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::System.IO.Stream mask, + string maskname, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeDesignV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeDesignV3.g.cs index e86ad16..384e94d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeDesignV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeDesignV3.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostLayerizeDesignV3AsResponseAsync( + + global::Ideogram.LayerizeDesignRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). /// @@ -103,5 +119,180 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? referenceAssetImages = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// An optional prompt to describe the image. If not provided, a prompt will be auto-generated from the image via captioning. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Font name from the available font library for H1 text. Ignored if font_file_h1 is provided.
+ /// Example: Ubuntu-Bold.ttf + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Font name from the available font library for H2 text. Ignored if font_file_h2 is provided. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Font name from the available font library for body text. Ignored if font_file_body is provided. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Font name from the available font library for small text. Ignored if font_file_small is provided. + /// + /// + /// A set of asset images (e.g., logos, icons) to use as references for detection and replacement (maximum 10 images). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'reference_asset_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostLayerizeDesignV3Async( + global::System.IO.Stream flatGraphicImage, + string flatGraphicImagename, + string? prompt = default, + int? seed = default, + global::System.IO.Stream? fontFileH1 = default, + string? fontFileH1name = default, + string? fontNameH1 = default, + global::System.IO.Stream? fontFileH2 = default, + string? fontFileH2name = default, + string? fontNameH2 = default, + global::System.IO.Stream? fontFileBody = default, + string? fontFileBodyname = default, + string? fontNameBody = default, + global::System.IO.Stream? fontFileSmall = default, + string? fontFileSmallname = default, + string? fontNameSmall = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImages = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Layerize an existing flat graphic image with text detection and correction
+ /// Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.
+ /// The uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// The flat graphic image to process for text detection and correction. The image should be in JPEG, PNG or WebP format (max size 10MB). + /// + /// + /// An optional prompt to describe the image. If not provided, a prompt will be auto-generated from the image via captioning. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Custom font file for H1 (heading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h1. + /// + /// + /// Font name from the available font library for H1 text. Ignored if font_file_h1 is provided.
+ /// Example: Ubuntu-Bold.ttf + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Custom font file for H2 (subheading) text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_h2. + /// + /// + /// Font name from the available font library for H2 text. Ignored if font_file_h2 is provided. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Custom font file for body text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_body. + /// + /// + /// Font name from the available font library for body text. Ignored if font_file_body is provided. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Custom font file for small/caption text. Supported formats .ttf, .otf, .woff, .woff2 (max 5MB). Takes priority over font_name_small. + /// + /// + /// Font name from the available font library for small text. Ignored if font_file_small is provided. + /// + /// + /// A set of asset images (e.g., logos, icons) to use as references for detection and replacement (maximum 10 images). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'reference_asset_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostLayerizeDesignV3AsResponseAsync( + global::System.IO.Stream flatGraphicImage, + string flatGraphicImagename, + string? prompt = default, + int? seed = default, + global::System.IO.Stream? fontFileH1 = default, + string? fontFileH1name = default, + string? fontNameH1 = default, + global::System.IO.Stream? fontFileH2 = default, + string? fontFileH2name = default, + string? fontNameH2 = default, + global::System.IO.Stream? fontFileBody = default, + string? fontFileBodyname = default, + string? fontNameBody = default, + global::System.IO.Stream? fontFileSmall = default, + string? fontFileSmallname = default, + string? fontNameSmall = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImages = default, + global::System.Collections.Generic.IReadOnlyList? referenceAssetImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeTextV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeTextV3.g.cs index cb122e9..bc02a7f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeTextV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostLayerizeTextV3.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
/// Image links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostLayerizeTextV3AsResponseAsync( + + global::Ideogram.LayerizeTextRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). /// @@ -50,5 +66,66 @@ public partial interface IGenerateClient int? seed = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// An optional text description of the image. If not provided, a description will be auto-generated from the image. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostLayerizeTextV3Async( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Layerize Text
+ /// Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.
+ /// The response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.
+ /// Supported image formats include JPEG, PNG, and WebP (max size 10MB).
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// The image to analyze for text detection. The image should be in JPEG, PNG, or WebP format (max size 10MB). + /// + /// + /// An optional text description of the image. If not provided, a description will be auto-generated from the image. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostLayerizeTextV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string? prompt = default, + int? seed = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImage.g.cs index fb9f670..d8b677e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImage.g.cs @@ -23,6 +23,20 @@ public partial interface IGenerateClient /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
/// Image links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReframeImageAsResponseAsync( + + global::Ideogram.ReframeImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -63,5 +77,96 @@ public partial interface IGenerateClient global::Ideogram.StyleType? styleType = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// (For model_version for 2.0 only, cannot be used in conjunction with aspect_ratio) The resolution to use for image generation, represented in width x height. If not specified, defaults to using aspect_ratio.
+ /// Example: RESOLUTION_1024_1024 + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostReframeImageAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.Resolution resolution, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Reframe (legacy)
+ /// Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// (For model_version for 2.0 only, cannot be used in conjunction with aspect_ratio) The resolution to use for image generation, represented in width x height. If not specified, defaults to using aspect_ratio.
+ /// Example: RESOLUTION_1024_1024 + /// + /// + /// The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.
+ /// Default Value: V_2
+ /// Example: V_2_TURBO + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.
+ /// Example: REALISTIC + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReframeImageAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.Resolution resolution, + global::Ideogram.ModelEnum model = global::Ideogram.ModelEnum.V2, + int? numImages = default, + int? seed = default, + global::Ideogram.StyleType? styleType = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImageV3.g.cs index e5827c0..899c534 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReframeImageV3.g.cs @@ -23,6 +23,20 @@ public partial interface IGenerateClient /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
/// Image links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReframeImageV3AsResponseAsync( + + global::Ideogram.ReframeImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -75,5 +89,128 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? styleReferenceImages = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostReframeImageV3Async( + global::System.IO.Stream image, + string imagename, + global::Ideogram.ResolutionV3 resolution, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Reframe with Ideogram 3.0
+ /// Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReframeImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.ResolutionV3 resolution, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImage.g.cs index 9a98aee..6bc5989 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImage.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageAsResponseAsync( + + global::Ideogram.RemixImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// A request to generate a new image using a provided image and a prompt.
/// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"ON","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","image_weight":50} @@ -46,5 +62,58 @@ public partial interface IGenerateClient string imageFilename, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to generate a new image using a provided image and a prompt.
+ /// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"ON","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","image_weight":50} + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemixImageAsync( + global::Ideogram.InitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix (legacy)
+ /// Remix provided images synchronously based on a given prompt and optional parameters.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to generate a new image using a provided image and a prompt.
+ /// Example: {"aspect_ratio":"ASPECT_10_16","magic_prompt_option":"ON","model":"V_2","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","image_weight":50} + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageAsResponseAsync( + global::Ideogram.InitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV3.g.cs index 54a4146..23bf1b0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV3.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageV3AsResponseAsync( + + global::Ideogram.RemixImageRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -60,6 +76,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -112,6 +131,7 @@ public partial interface IGenerateClient global::Ideogram.AspectRatioV3? aspectRatio = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, string? negativePrompt = default, int? numImages = default, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, @@ -124,5 +144,246 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? characterReferenceImagesMask = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt to use to generate the image.
+ /// Example: A photo of a cat + /// + /// + /// Default Value: 50
+ /// Example: 50 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The aspect ratio to use for image generation, which determines the image's resolution. Cannot be used in conjunction with resolution. Defaults to 1x1. + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// Description of what to exclude from an image. Descriptions in the prompt take precedence
+ /// to descriptions in the negative prompt.
+ /// Example: brush strokes, painting + /// + /// + /// Number of images to generate.
+ /// Default Value: 1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemixImageV3Async( + global::System.IO.Stream image, + string imagename, + string prompt, + int? imageWeight = default, + int? seed = default, + global::Ideogram.ResolutionV3? resolution = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + string? negativePrompt = default, + int? numImages = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix with Ideogram 3.0
+ /// Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.
+ /// Input images are cropped to the chosen aspect ratio before being remixed.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image to remix binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt to use to generate the image.
+ /// Example: A photo of a cat + /// + /// + /// Default Value: 50
+ /// Example: 50 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The resolutions supported for Ideogram 3.0.
+ /// Example: 1280x800 + /// + /// + /// The aspect ratio to use for image generation, which determines the image's resolution. Cannot be used in conjunction with resolution. Defaults to 1x1. + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// Description of what to exclude from an image. Descriptions in the prompt take precedence
+ /// to descriptions in the negative prompt.
+ /// Example: brush strokes, painting + /// + /// + /// Number of images to generate.
+ /// Default Value: 1 + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// A custom model URI in the format model/<model_name>/version/<version_name>.
+ /// When provided, the model version and style will be resolved from this URI, and style_type is not required.
+ /// Example: model/my-custom-model/version/1 + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// + /// Generations with character reference are subject to the character reference pricing. A set of images to use as character references (maximum total size 10MB across all character references), currently only supports 1 character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images' file parts. + /// + /// + /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'character_reference_images_mask' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string prompt, + int? imageWeight = default, + int? seed = default, + global::Ideogram.ResolutionV3? resolution = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + string? negativePrompt = default, + int? numImages = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + string? customModelUri = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesFileNames = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMask = default, + global::System.Collections.Generic.IReadOnlyList? characterReferenceImagesMaskFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV4.g.cs new file mode 100644 index 0000000..37b8419 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemixImageV4.g.cs @@ -0,0 +1,182 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemixImageV4Async( + + global::Ideogram.RemixImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageV4AsResponseAsync( + + global::Ideogram.RemixImageRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemixImageV4Async( + byte[] image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemixImageV4Async( + global::System.IO.Stream image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remix with Ideogram 4.0
+ /// Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.
+ /// Mirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the
+ /// output should resemble the input image) but routes the request through the V_4_0 model.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemixImageV4AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string textPrompt, + int? imageWeight = default, + global::Ideogram.ResolutionV4? resolution = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + bool? enableCopyrightDetection = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemoveBackground.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemoveBackground.g.cs new file mode 100644 index 0000000..73a6f66 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostRemoveBackground.g.cs @@ -0,0 +1,109 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IGenerateClient + { + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + + global::Ideogram.RemoveBackgroundRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemoveBackgroundAsResponseAsync( + + global::Ideogram.RemoveBackgroundRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + byte[] image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostRemoveBackgroundAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remove Background
+ /// Remove the background of a given image synchronously. The foreground subject
+ /// is identified and returned on a transparent background. Supported image formats include JPEG,
+ /// PNG, and WebP.
+ /// Image links are available for a limited period of time; if you would like to keep the image,
+ /// you must download it. + ///
+ /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostRemoveBackgroundAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReplaceBackgroundV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReplaceBackgroundV3.g.cs index 0cd12f8..73e3be7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReplaceBackgroundV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostReplaceBackgroundV3.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReplaceBackgroundV3AsResponseAsync( + + global::Ideogram.ReplaceBackgroundRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -41,6 +57,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -75,6 +94,7 @@ public partial interface IGenerateClient string imagename, string prompt, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, @@ -84,5 +104,150 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList? styleReferenceImages = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired new background.
+ /// Example: A vibrant cityscape at night. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostReplaceBackgroundV3Async( + global::System.IO.Stream image, + string imagename, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Replace Background with Ideogram 3.0
+ /// Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject
+ /// will be identified and kept, while the background is replaced based on the prompt and chosen style.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being replaced (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired new background.
+ /// Example: A vibrant cityscape at night. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// 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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models. + /// + /// + /// A list of 8 character hexadecimal codes representing the style of the image. Cannot be used in conjunction with style_reference_images or style_type.
+ /// Example: [AAFF5733, 0133FF57, DE3357FF] + /// + /// + /// A set of images to use as style references (maximum total size 10MB across all style references). The images should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'style_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostReplaceBackgroundV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + string prompt, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette = default, + global::System.Collections.Generic.IList? styleCodes = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImages = default, + global::System.Collections.Generic.IReadOnlyList? styleReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostTryOnV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostTryOnV3.g.cs index 4165f99..dd94d16 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostTryOnV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostTryOnV3.g.cs @@ -29,6 +29,23 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostTryOnV3AsResponseAsync( + + global::Ideogram.TryOnRequestV3 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -44,6 +61,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -77,11 +97,155 @@ public partial interface IGenerateClient global::System.Collections.Generic.IList productReferenceImages, string? prompt = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired clothing change. Defaults to "Person wearing this piece of clothing" if omitted or empty.
+ /// Default Value: Person wearing this piece of clothing
+ /// Example: Change his shirt to a pink shirt + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// An image to use as the product reference for the try-on (exactly 1 image required). The image should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'product_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostTryOnV3Async( + global::System.IO.Stream image, + string imagename, + global::System.Collections.Generic.IReadOnlyList productReferenceImages, + string? prompt = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, + int? numImages = default, + int? seed = default, + global::Ideogram.RenderingSpeed? renderingSpeed = default, + global::Ideogram.StyleTypeV3? styleType = default, + global::Ideogram.StylePresetV3? stylePreset = default, + global::System.Collections.Generic.IReadOnlyList? productReferenceImagesFileNames = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Virtual Try-On with Ideogram 3.0
+ /// Performs virtual clothing try-on by automatically segmenting the clothing in the provided image
+ /// and replacing it based on the prompt. The user provides an image and an optional prompt describing
+ /// the desired clothing change (e.g., "change his shirt to a pink shirt").
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image containing a person wearing clothing to be modified (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The prompt describing the desired clothing change. Defaults to "Person wearing this piece of clothing" if omitted or empty.
+ /// Default Value: Person wearing this piece of clothing
+ /// Example: Change his shirt to a pink shirt + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The number of images to generate.
+ /// Default Value: 1 + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// The style type to generate with.
+ /// Default Value: GENERAL
+ /// Example: GENERAL + /// + /// + /// A predefined style preset that applies a specific artistic style to the generated image.
+ /// Example: BRIGHT_ART + /// + /// + /// An image to use as the product reference for the try-on (exactly 1 image required). The image should be in JPEG, PNG or WebP format. + /// + /// + /// Optional file names to use for the multipart 'product_reference_images' file parts. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostTryOnV3AsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::System.Collections.Generic.IReadOnlyList productReferenceImages, + string? prompt = default, + global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, int? numImages = default, int? seed = default, global::Ideogram.RenderingSpeed? renderingSpeed = default, global::Ideogram.StyleTypeV3? styleType = default, global::Ideogram.StylePresetV3? stylePreset = default, + global::System.Collections.Generic.IReadOnlyList? productReferenceImagesFileNames = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostUpscaleImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostUpscaleImage.g.cs index 2c0e8fb..6fb56ff 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostUpscaleImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostUpscaleImage.g.cs @@ -25,6 +25,21 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostUpscaleImageAsResponseAsync( + + global::Ideogram.UpscaleImageRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// A request to upscale a provided image with the help of an optional prompt. /// @@ -43,5 +58,54 @@ public partial interface IGenerateClient string imageFilename, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to upscale a provided image with the help of an optional prompt. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostUpscaleImageAsync( + global::Ideogram.UpscaleInitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upscale
+ /// Upscale provided images synchronously with an optional prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ /// + /// A request to upscale a provided image with the help of an optional prompt. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostUpscaleImageAsResponseAsync( + global::Ideogram.UpscaleInitialImageRequest imageRequest, + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostV1EditImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostV1EditImage.g.cs index 37dd6d9..c564cb9 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostV1EditImage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IGenerateClient.PostV1EditImage.g.cs @@ -27,6 +27,22 @@ public partial interface IGenerateClient /// Supported image formats include JPEG, PNG, and WebP.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostV1EditImageAsResponseAsync( + + global::Ideogram.V1EditImagesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Edit images with a prompt
+ /// Edit one or more images using a text prompt. Provide images via file upload
+ /// or Ideogram image URLs, and describe the desired edit in your prompt.
+ /// Supported image formats include JPEG, PNG, and WebP.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
/// /// The prompt describing the desired edit.
/// Example: Change the background to a beach sunset. @@ -49,6 +65,9 @@ public partial interface IGenerateClient /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The resolutions supported for Ideogram 3.0.
/// Example: 1280x800 @@ -70,6 +89,7 @@ public partial interface IGenerateClient int? numImages = default, int? seed = default, global::Ideogram.MagicPromptOption? magicPrompt = default, + string? magicPromptSystemPromptConfigId = default, global::Ideogram.ResolutionV3? resolution = default, global::Ideogram.AspectRatioV3? aspectRatio = default, bool? transparentBackground = default, diff --git a/src/libs/Ideogram/Generated/Ideogram.IIdeogramClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.IIdeogramClient.g.cs index e9c6bf5..d4044e3 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IIdeogramClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IIdeogramClient.g.cs @@ -85,5 +85,12 @@ public partial interface IIdeogramClient : global::System.IDisposable /// public VisionClient Vision { get; } + /// + /// Endpoints related to webhook delivery and verification. The JWKS
+ /// endpoint publishes the Ed25519 public keys customers use to verify
+ /// that an inbound webhook genuinely originated from Ideogram. + ///
+ public WebhooksClient Webhooks { get; } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IInternalTestingClient.PostInternalTesting.g.cs b/src/libs/Ideogram/Generated/Ideogram.IInternalTestingClient.PostInternalTesting.g.cs index 89cf74e..7f5d051 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IInternalTestingClient.PostInternalTesting.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IInternalTestingClient.PostInternalTesting.g.cs @@ -27,6 +27,23 @@ public partial interface IInternalTestingClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostInternalTestingAsResponseAsync( + + global::Ideogram.InternalTestingRequest request, + string? xTestHeader = default, + string? xTestHeader2 = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Testing
+ /// Just a testing endpoint + ///
+ /// + /// /// /// /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.AddOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.AddOrganizationMembers.g.cs index a356491..81a3252 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.AddOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.AddOrganizationMembers.g.cs @@ -22,6 +22,20 @@ public partial interface IManageClient /// Add members to a specific organization /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AddOrganizationMembersAsResponseAsync( + string organizationId, + + global::Ideogram.AddOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Add members to a specific organization + /// + /// /// /// List of organization members to add
/// Default Value: [] diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKey.g.cs index 9251be3..bc405e5 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKey.g.cs @@ -7,10 +7,38 @@ public partial interface IManageClient /// /// Creates an API key. /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateApiKeyAsync( + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an API key. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateApiKeyAsResponseAsync( + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an API key. + /// + /// + /// User-supplied label shown alongside the key in the management UI. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateApiKeyAsync( + string? label = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKeyV2.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKeyV2.g.cs index 88a2ab5..ec34ff7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKeyV2.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiKeyV2.g.cs @@ -8,11 +8,43 @@ public partial interface IManageClient /// Create an API key for a specific organization /// /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task CreateApiKeyV2Async( string organizationId, + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an API key for a specific organization + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateApiKeyV2AsResponseAsync( + string organizationId, + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an API key for a specific organization + /// + /// + /// + /// User-supplied label shown alongside the key in the management UI. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateApiKeyV2Async( + string organizationId, + string? label = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiPayment.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiPayment.g.cs new file mode 100644 index 0000000..b5dbe37 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.CreateApiPayment.g.cs @@ -0,0 +1,44 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Create a payment setup session for inline card collection.
+ /// Returns a client_secret for the org's payment customer so the inline payment
+ /// modal can save a card without leaving the app.
+ /// Soft-deprecated: the inline Elements flow was removed in the Stripe.js
+ /// eager-bundle incident (2026-05-20). New clients should use the
+ /// stripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which
+ /// returns a hosted Stripe Checkout URL instead. This endpoint will be formally
+ /// deprecated and then removed once no callers reference it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateApiPaymentAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a payment setup session for inline card collection.
+ /// Returns a client_secret for the org's payment customer so the inline payment
+ /// modal can save a card without leaving the app.
+ /// Soft-deprecated: the inline Elements flow was removed in the Stripe.js
+ /// eager-bundle incident (2026-05-20). New clients should use the
+ /// stripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which
+ /// returns a hosted Stripe Checkout URL instead. This endpoint will be formally
+ /// deprecated and then removed once no callers reference it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateApiPaymentAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeactivateOrganizationApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeactivateOrganizationApiKey.g.cs index 0ed6131..2085cb2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeactivateOrganizationApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeactivateOrganizationApiKey.g.cs @@ -15,5 +15,16 @@ public partial interface IManageClient string apiKeyId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deactivate an API key for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeactivateOrganizationApiKeyAsResponseAsync( + string apiKeyId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeleteSingleApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeleteSingleApiKey.g.cs index 39e5875..1698bfd 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeleteSingleApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.DeleteSingleApiKey.g.cs @@ -15,5 +15,16 @@ public partial interface IManageClient string apiKeyId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an API key. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteSingleApiKeyAsResponseAsync( + string apiKeyId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiCreditSummary.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiCreditSummary.g.cs new file mode 100644 index 0000000..0add9b0 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiCreditSummary.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Lifetime credit totals for the API user's account.
+ /// Returns the lifetime credit KPIs (consumed, expired, issued) used to
+ /// render the API credit dashboard strip. All values default to $0 when
+ /// Metronome is unavailable so the FE can always render. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetApiCreditSummaryAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lifetime credit totals for the API user's account.
+ /// Returns the lifetime credit KPIs (consumed, expired, issued) used to
+ /// render the API credit dashboard strip. All values default to $0 when
+ /// Metronome is unavailable so the FE can always render. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiCreditSummaryAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeys.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeys.g.cs index d7e0474..35148b7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeys.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeys.g.cs @@ -13,5 +13,14 @@ public partial interface IManageClient global::System.Threading.Tasks.Task GetApiKeysAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve current API keys and their respective data. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiKeysAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeysV2.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeysV2.g.cs index 6b962d4..a89ec32 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeysV2.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiKeysV2.g.cs @@ -15,5 +15,16 @@ public partial interface IManageClient string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve API keys for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiKeysV2AsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiOrganizationUserSuggestions.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiOrganizationUserSuggestions.g.cs index dcf3e19..eb5a020 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiOrganizationUserSuggestions.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiOrganizationUserSuggestions.g.cs @@ -21,5 +21,22 @@ public partial interface IManageClient int? maxItems = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get search results for user handles with suggestions for a particular organization. + /// + /// + /// + /// + /// Default Value: 3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiOrganizationUserSuggestionsAsResponseAsync( + string organizationId, + string? userHandlePrefix = default, + int? maxItems = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiProfiles.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiProfiles.g.cs index ffc8856..e1ccade 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiProfiles.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiProfiles.g.cs @@ -13,5 +13,14 @@ public partial interface IManageClient global::System.Threading.Tasks.Task GetApiProfilesAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve the user's current API profiles + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiProfilesAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiStripeSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiStripeSubscription.g.cs index 5fb6499..ed33015 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiStripeSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiStripeSubscription.g.cs @@ -7,11 +7,26 @@ public partial interface IManageClient /// /// Retrieve data relevant to connecting to Stripe. /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetApiStripeSubscriptionAsync( + string organizationId, + bool? isBusiness = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve data relevant to connecting to Stripe. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiStripeSubscriptionAsResponseAsync( + string organizationId, bool? isBusiness = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiSubscription.g.cs index 26525d7..6d243e0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiSubscription.g.cs @@ -7,10 +7,23 @@ public partial interface IManageClient /// /// Retrieve data relevant to creating an API subscription. /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task GetApiSubscriptionAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve data relevant to creating an API subscription. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiSubscriptionAsResponseAsync( + string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiTerms.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiTerms.g.cs index 1869981..308fa93 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiTerms.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetApiTerms.g.cs @@ -13,5 +13,14 @@ public partial interface IManageClient global::System.Threading.Tasks.Task GetApiTermsAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve the latest terms of service for API usage. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetApiTermsAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationBillingPortal.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationBillingPortal.g.cs new file mode 100644 index 0000000..6a68434 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationBillingPortal.g.cs @@ -0,0 +1,30 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Retrieve the Stripe billing portal URL for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetOrganizationBillingPortalAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve the Stripe billing portal URL for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetOrganizationBillingPortalAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationMembers.g.cs index 0b518ef..150af36 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetOrganizationMembers.g.cs @@ -15,5 +15,16 @@ public partial interface IManageClient string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve members of a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetOrganizationMembersAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUsageInfo.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUsageInfo.g.cs index 38803b2..f48323b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUsageInfo.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUsageInfo.g.cs @@ -45,5 +45,46 @@ public partial interface IManageClient global::Ideogram.UsageSource? source = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve usage information segmented by time period with tool-specific breakdowns + /// + /// + /// + /// Time segment granularity for usage breakdown
+ /// Example: DAY + /// + /// + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Filter usage by source - API for programmatic API usage, APP for web application usage
+ /// Default Value: API + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetUsageInfoAsResponseAsync( + string organizationId, + global::Ideogram.SegmentBy segmentBy, + global::System.DateTime startTime, + global::System.DateTime? endTime = default, + global::System.Collections.Generic.IList? modelVersions = default, + global::System.Collections.Generic.IList? tools = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? userEmails = default, + global::Ideogram.UsageSource? source = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserCredits.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserCredits.g.cs index 813604c..e0c3178 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserCredits.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserCredits.g.cs @@ -19,5 +19,20 @@ public partial interface IManageClient global::System.DateTime? endTime = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve user credit information and spending metrics + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetUserCreditsAsResponseAsync( + string organizationId, + global::System.DateTime startTime, + global::System.DateTime? endTime = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserSpendCommitInfo.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserSpendCommitInfo.g.cs index 96d01b4..e50a712 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserSpendCommitInfo.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.GetUserSpendCommitInfo.g.cs @@ -17,5 +17,18 @@ public partial interface IManageClient bool? postpaidOnly = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve user spend commit information + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetUserSpendCommitInfoAsResponseAsync( + string organizationId, + bool? postpaidOnly = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.ListOrganizationInvoices.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.ListOrganizationInvoices.g.cs index 76d7972..2c8b038 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.ListOrganizationInvoices.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.ListOrganizationInvoices.g.cs @@ -15,5 +15,16 @@ public partial interface IManageClient string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve invoices for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListOrganizationInvoicesAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs index 644a24a..f54aadd 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostAddCreditsForApi.g.cs @@ -7,11 +7,13 @@ public partial interface IManageClient /// /// Add credits to an API user's account. /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + string organizationId, global::Ideogram.PostAddCreditsRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, @@ -19,6 +21,21 @@ public partial interface IManageClient /// /// Add credits to an API user's account. /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostAddCreditsForApiAsResponseAsync( + string organizationId, + + global::Ideogram.PostAddCreditsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Add credits to an API user's account. + /// + /// /// /// Represents a price.
/// Example: {"amount":1050,"currency_code":"USD"} @@ -27,6 +44,7 @@ public partial interface IManageClient /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + string organizationId, global::Ideogram.Price amount, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiSubscription.g.cs index 37e86a9..705c1dc 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiSubscription.g.cs @@ -7,11 +7,13 @@ public partial interface IManageClient /// /// Update API subscription settings /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostApiSubscriptionAsync( + string organizationId, global::Ideogram.PostApiSubscriptionRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, @@ -19,6 +21,21 @@ public partial interface IManageClient /// /// Update API subscription settings /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostApiSubscriptionAsResponseAsync( + string organizationId, + + global::Ideogram.PostApiSubscriptionRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update API subscription settings + /// + /// /// /// The current recharge settings for the API subscription.
/// Example: {"minimum_balance_threshold":{"amount":1050,"currency_code":"USD"},"top_up_balance":{"amount":1050,"currency_code":"USD"}} @@ -30,6 +47,7 @@ public partial interface IManageClient /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostApiSubscriptionAsync( + string organizationId, global::Ideogram.RechargeSettings? rechargeSettings = default, bool? isActive = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiTerms.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiTerms.g.cs index 9072bd3..4c1a83b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiTerms.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PostApiTerms.g.cs @@ -19,6 +19,18 @@ public partial interface IManageClient /// /// Accept terms /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostApiTermsAsResponseAsync( + + global::Ideogram.PostApiTermsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Accept terms + /// /// /// The ID of the terms which are being accepted.
/// Example: TOS_2024_04_20 diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PromoteOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PromoteOrganizationMembers.g.cs index e3df422..93a3565 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.PromoteOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.PromoteOrganizationMembers.g.cs @@ -22,6 +22,20 @@ public partial interface IManageClient /// Promote members to OWNER role in a specific organization /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PromoteOrganizationMembersAsResponseAsync( + string organizationId, + + global::Ideogram.PromoteOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Promote members to OWNER role in a specific organization + /// + /// /// /// List of organization members to promote to OWNER role
/// Default Value: [] diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.ReactivateSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.ReactivateSubscription.g.cs index 4be866c..21ec74b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.ReactivateSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.ReactivateSubscription.g.cs @@ -13,5 +13,14 @@ public partial interface IManageClient global::System.Threading.Tasks.Task ReactivateSubscriptionAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Reactivates a subscription by attempting to re-enable Metronome billing. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ReactivateSubscriptionAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.RemoveOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.RemoveOrganizationMembers.g.cs index e9e8616..795a7a2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IManageClient.RemoveOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.RemoveOrganizationMembers.g.cs @@ -22,6 +22,20 @@ public partial interface IManageClient /// Remove members from a specific organization /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RemoveOrganizationMembersAsResponseAsync( + string organizationId, + + global::Ideogram.RemoveOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Remove members from a specific organization + /// + /// /// /// List of organization members to remove
/// Default Value: [] diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateOrganizationApiProperties.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateOrganizationApiProperties.g.cs new file mode 100644 index 0000000..5e8cda6 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateOrganizationApiProperties.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateOrganizationApiPropertiesAsync( + string organizationId, + + global::Ideogram.UpdateOrganizationApiPropertiesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateOrganizationApiPropertiesAsResponseAsync( + string organizationId, + + global::Ideogram.UpdateOrganizationApiPropertiesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Toggle post-generation Hive likeness + logo detection for this organization. See ApiProfile.copyright_detection_enabled for behavior. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateOrganizationApiPropertiesAsync( + string organizationId, + bool? copyrightDetectionEnabled = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateSingleApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateSingleApiKey.g.cs new file mode 100644 index 0000000..f7d9022 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IManageClient.UpdateSingleApiKey.g.cs @@ -0,0 +1,52 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IManageClient + { + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateSingleApiKeyAsync( + string apiKeyId, + + global::Ideogram.PatchApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateSingleApiKeyAsResponseAsync( + string apiKeyId, + + global::Ideogram.PatchApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// New label for the API key. Pass null (or omit) to clear the existing label.
+ /// Example: Live production environment + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateSingleApiKeyAsync( + string apiKeyId, + string? label = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.GetCustomModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.GetCustomModel.g.cs index 2abb1b2..bb16532 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.GetCustomModel.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.GetCustomModel.g.cs @@ -16,5 +16,17 @@ public partial interface IModelsClient string modelId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get model details
+ /// Get detailed information about a specific custom model. The user must either own the model or the model must be shared with the user's organization via the model registry. Returns 404 if the model is not found or not accessible. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetCustomModelAsResponseAsync( + string modelId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.ListCustomModels.g.cs b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.ListCustomModels.g.cs index 491e2c9..8afc917 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.ListCustomModels.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.ListCustomModels.g.cs @@ -18,5 +18,19 @@ public partial interface IModelsClient global::System.Collections.Generic.IList? status = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List models
+ /// Lists custom models for the authenticated user. Use the `scope` parameter to control which models are returned. If omitted, returns both owned models and models shared with the user's organization via the model registry. `owned` returns only models created by the user. `shared` returns only models shared via the model registry, excluding the user's own models. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListCustomModelsAsResponseAsync( + global::Ideogram.ListCustomModelsScope? scope = default, + global::System.Collections.Generic.IList? status = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3.g.cs index 1b7b710..1e4dec7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3.g.cs @@ -21,6 +21,19 @@ public partial interface IModelsClient /// Train a custom Ideogram v3 model
/// Start training a custom Ideogram v3 model from a dataset using default hyperparameters. The dataset must contain at least 15 images and a maximum of 100 images. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> TrainModelV3AsResponseAsync( + + global::Ideogram.TrainModelV3Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Train a custom Ideogram v3 model
+ /// Start training a custom Ideogram v3 model from a dataset using default hyperparameters. The dataset must contain at least 15 images and a maximum of 100 images. + ///
/// /// ID of the dataset to train the model from.
/// Example: abc123 diff --git a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3Advanced.g.cs b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3Advanced.g.cs index 20ad2af..2ff5014 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3Advanced.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IModelsClient.TrainModelV3Advanced.g.cs @@ -21,6 +21,19 @@ public partial interface IModelsClient /// Train a custom Ideogram v3 model with advanced hyperparameters
/// Start training a custom Ideogram v3 model from a dataset with caller-supplied hyperparameters (training steps, LoRA rank, EMA decay, learning rate). All hyperparameters are optional and fall back to defaults when omitted. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> TrainModelV3AdvancedAsResponseAsync( + + global::Ideogram.TrainModelV3AdvancedRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Train a custom Ideogram v3 model with advanced hyperparameters
+ /// Start training a custom Ideogram v3 model from a dataset with caller-supplied hyperparameters (training steps, LoRA rank, EMA decay, learning rate). All hyperparameters are optional and fall back to defaults when omitted. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. + ///
/// /// ID of the dataset to train the model from.
/// Example: abc123 diff --git a/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPrompt.g.cs b/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPrompt.g.cs index 7a61033..4c694fa 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPrompt.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPrompt.g.cs @@ -21,8 +21,22 @@ public partial interface IPromptClient /// Generate Magic Prompt
/// Transforms basic prompts into a magic prompt. Internal use only (feature flagged). TODO: update description if enabled externally. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostMagicPromptAsResponseAsync( + + global::Ideogram.MagicPromptRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate Magic Prompt
+ /// Transforms basic prompts into a magic prompt. Internal use only (feature flagged). TODO: update description if enabled externally. + ///
/// - /// The prompt to enhance with a magic prompt
+ /// The prompt to enhance with a magic prompt. Mutually
+ /// exclusive with `messages`; one of the two must be set.
/// Example: a cat /// /// @@ -50,17 +64,79 @@ public partial interface IPromptClient /// A system prompt to use for the magic prompt.
/// Example: You are a helpful assistant that generates magic prompts for images. /// + /// + /// Optional target aspect ratio used to condition the generated
+ /// magic prompt's framing. Forwarded to the autoprompt pipeline
+ /// so registry-driven system prompts that interpolate
+ /// `` see the bucket the caller intends. + /// + /// + /// Sampling temperature override. Defaults to the trainer-conditioned
+ /// value when omitted (0.7 for V4_QWEN_3_5_27B). Only honored with
+ /// V4 magic-prompt versions; supplying it with another version
+ /// returns 400. + /// + /// + /// Nucleus-sampling top_p override. Only honored with V4 versions. + /// + /// + /// Top-k sampling override. Only honored with V4 versions. + /// + /// + /// min_p sampling override. Only honored with V4 versions. + /// + /// + /// Cap on the number of tokens the model may generate. Defaults to
+ /// 4096 (the trainer's reference cap) when omitted. Only honored
+ /// with V4 versions. + /// + /// + /// Presence-penalty override. Only honored with V4 versions. + /// + /// + /// Frequency-penalty override. Only honored with V4 versions. + /// + /// + /// Repetition-penalty override. Only honored with V4 versions. + /// + /// + /// Optional override of the LoRA adapter the V4 magic-prompt
+ /// wrapper downloads and runs. Pass a `gs://` URI pointing at a
+ /// checkpoint directory containing `adapter_config.json`. When
+ /// omitted, the wrapper-preloaded production checkpoint is used.
+ /// Honored with the wrapper-routed LoRA versions
+ /// `V4_QWEN_3_5_27B` and `V4_QWEN_3_5_27B_FULL_FINETUNE_LORA`;
+ /// supplying it with `V4_QWEN_3_5_27B_PREFUSED` or
+ /// `V4_QWEN_3_5_27B_FULL_FINETUNE` (which serve fixed weights and
+ /// cannot swap adapters per request) or any other version returns
+ /// 400. + /// + /// + /// Pre-formed chat messages forwarded verbatim to V4. Mutually
+ /// exclusive with `prompt`; exactly one must be set. V4 only. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// global::System.Threading.Tasks.Task PostMagicPromptAsync( - string prompt, global::Ideogram.MagicPromptVersionEnum magicPromptVersion, bool classifyPromptCategory, + string? prompt = default, global::Ideogram.StyleTypeV3? styleType = default, int? seed = default, global::System.Collections.Generic.IList? characterReferenceImages = default, string? systemPrompt = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + float? temperature = default, + float? topP = default, + int? topK = default, + float? minP = default, + int? maxTokens = default, + float? presencePenalty = default, + float? frequencyPenalty = default, + float? repetitionPenalty = default, + string? checkpoint = default, + global::System.Collections.Generic.IList? messages = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPromptV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPromptV4.g.cs new file mode 100644 index 0000000..f4ef819 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IPromptClient.PostMagicPromptV4.g.cs @@ -0,0 +1,65 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IPromptClient + { + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostMagicPromptV4Async( + + global::Ideogram.MagicPromptV4Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostMagicPromptV4AsResponseAsync( + + global::Ideogram.MagicPromptV4Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// The natural-language prompt to enhance into an Ideogram 4.0 magic
+ /// prompt. Named `text_prompt` to match the Ideogram 4.0 generate
+ /// request surface.
+ /// Example: a cat + /// + /// + /// Target aspect ratio. Defaults to `AUTO`, which lets the model
+ /// select the most suitable ratio and return it in the response. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostMagicPromptV4Async( + string textPrompt, + global::Ideogram.AspectRatioV4? aspectRatio = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribe.g.cs b/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribe.g.cs index bb12700..5cfe73a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribe.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribe.g.cs @@ -23,6 +23,20 @@ public partial interface IVisionClient /// Describe an image.
/// Supported image formats include JPEG, PNG, and WebP. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostDescribeAsResponseAsync( + + global::Ideogram.DescribeRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
/// /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. /// @@ -42,5 +56,54 @@ public partial interface IVisionClient global::Ideogram.DescribeModelVersion? describeModelVersion = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The model version to use for describing images. Defaults to V_3.
+ /// Default Value: V_3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostDescribeAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.DescribeModelVersion? describeModelVersion = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The model version to use for describing images. Defaults to V_3.
+ /// Default Value: V_3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostDescribeAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.DescribeModelVersion? describeModelVersion = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribeV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribeV4.g.cs new file mode 100644 index 0000000..176beaa --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IVisionClient.PostDescribeV4.g.cs @@ -0,0 +1,181 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IVisionClient + { + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostDescribeV4Async( + + global::Ideogram.DescribeRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostDescribeV4AsResponseAsync( + + global::Ideogram.DescribeRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostDescribeV4Async( + byte[] imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PostDescribeV4Async( + global::System.IO.Stream imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PostDescribeV4AsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.GetWebhookSigningJwks.g.cs b/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.GetWebhookSigningJwks.g.cs new file mode 100644 index 0000000..d16dc74 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.GetWebhookSigningJwks.g.cs @@ -0,0 +1,46 @@ +#nullable enable + +namespace Ideogram +{ + public partial interface IWebhooksClient + { + /// + /// Get the public keys used to verify webhook signatures
+ /// Returns the set of Ed25519 public keys Ideogram uses to sign outbound
+ /// webhook payloads. Customers verify incoming webhooks by recomputing the
+ /// canonical signed message (`request_id\nuser_id\ntimestamp\nsha256_hex(body)`)
+ /// and checking the `X-Ideogram-Webhook-Signature` header against any key
+ /// in this document.
+ /// The document includes the current signing key plus any keys recently
+ /// rotated out, so signatures already in flight remain verifiable across
+ /// rotations. Cache for up to 24 hours; refresh sooner if a signature
+ /// fails to verify against the cached set.
+ /// This endpoint is public and unauthenticated — no API key is required. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetWebhookSigningJwksAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get the public keys used to verify webhook signatures
+ /// Returns the set of Ed25519 public keys Ideogram uses to sign outbound
+ /// webhook payloads. Customers verify incoming webhooks by recomputing the
+ /// canonical signed message (`request_id\nuser_id\ntimestamp\nsha256_hex(body)`)
+ /// and checking the `X-Ideogram-Webhook-Signature` header against any key
+ /// in this document.
+ /// The document includes the current signing key plus any keys recently
+ /// rotated out, so signatures already in flight remain verifiable across
+ /// rotations. Cache for up to 24 hours; refresh sooner if a signature
+ /// fails to verify against the cached set.
+ /// This endpoint is public and unauthenticated — no API key is required. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetWebhookSigningJwksAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.g.cs new file mode 100644 index 0000000..b6526bb --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.IWebhooksClient.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Endpoints related to webhook delivery and verification. The JWKS
+ /// endpoint publishes the Ed25519 public keys customers use to verify
+ /// that an inbound webhook genuinely originated from Ideogram.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IWebhooksClient : global::System.IDisposable + { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// When false, successful responses are deserialized directly from the response stream for better performance. + /// Error responses are always read as strings regardless of this setting, + /// ensuring is populated. + /// + public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::Ideogram.AutoSDKClientOptions Options { get; } + + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.Constructors.Bearer.g.cs b/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.Constructors.Bearer.g.cs index ee87552..a6b49fa 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.Constructors.Bearer.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.Constructors.Bearer.g.cs @@ -26,5 +26,6 @@ partial void Authorizing( ref string apiKey); partial void Authorized( global::System.Net.Http.HttpClient client); + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.g.cs index 5bde80b..b52807d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.IdeogramClient.g.cs @@ -43,7 +43,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// /// - public BatchClient Batch => new BatchClient(HttpClient, authorizations: Authorizations, options: Options) + public BatchClient Batch => new BatchClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -52,7 +52,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// Operations related to managing datasets. /// - public DatasetsClient Datasets => new DatasetsClient(HttpClient, authorizations: Authorizations, options: Options) + public DatasetsClient Datasets => new DatasetsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -61,7 +61,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// All things related to generating content. /// - public GenerateClient Generate => new GenerateClient(HttpClient, authorizations: Authorizations, options: Options) + public GenerateClient Generate => new GenerateClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -70,7 +70,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// Operations and endpoints designed for doing internal testing. Not intended to be called outside a test environment. /// - public InternalTestingClient InternalTesting => new InternalTestingClient(HttpClient, authorizations: Authorizations, options: Options) + public InternalTestingClient InternalTesting => new InternalTestingClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -79,7 +79,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// Content related to managing API account and API access. /// - public ManageClient Manage => new ManageClient(HttpClient, authorizations: Authorizations, options: Options) + public ManageClient Manage => new ManageClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -88,7 +88,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// Operations related to managing custom models. /// - public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations, options: Options) + public ModelsClient Models => new ModelsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -97,7 +97,7 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// /// - public PromptClient Prompt => new PromptClient(HttpClient, authorizations: Authorizations, options: Options) + public PromptClient Prompt => new PromptClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -106,7 +106,18 @@ public sealed partial class IdeogramClient : global::Ideogram.IIdeogramClient, g /// /// Operations related to understanding visual content. /// - public VisionClient Vision => new VisionClient(HttpClient, authorizations: Authorizations, options: Options) + public VisionClient Vision => new VisionClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContext = JsonSerializerContext, + }; + + /// + /// Endpoints related to webhook delivery and verification. The JWKS
+ /// endpoint publishes the Ed25519 public keys customers use to verify
+ /// that an inbound webhook genuinely originated from Ideogram. + ///
+ public WebhooksClient Webhooks => new WebhooksClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -134,6 +145,27 @@ public IdeogramClient( { } + /// + /// Creates a new instance of the IdeogramClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public IdeogramClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the IdeogramClient. /// If no httpClient is provided, a new one will be created. @@ -145,10 +177,10 @@ public IdeogramClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public IdeogramClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.PostInternalTesting.g.cs b/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.PostInternalTesting.g.cs index 29e3402..04e4092 100644 --- a/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.PostInternalTesting.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.PostInternalTesting.g.cs @@ -57,6 +57,35 @@ partial void ProcessPostInternalTestingResponseContent( /// public async global::System.Threading.Tasks.Task PostInternalTestingAsync( + global::Ideogram.InternalTestingRequest request, + string? xTestHeader = default, + string? xTestHeader2 = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostInternalTestingAsResponseAsync( + + request: request, + xTestHeader: xTestHeader, + xTestHeader2: xTestHeader2, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Testing
+ /// Just a testing endpoint + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostInternalTestingAsResponseAsync( + global::Ideogram.InternalTestingRequest request, string? xTestHeader = default, string? xTestHeader2 = default, @@ -91,10 +120,11 @@ partial void ProcessPostInternalTestingResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/internal-testing", baseUri: HttpClient.BaseAddress); @@ -137,6 +167,7 @@ partial void ProcessPostInternalTestingResponseContent( __httpRequest.Headers.TryAddWithoutValidation("X-Test-Header-2", xTestHeader2.ToString()); } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); if (xTestHeader != default) { @@ -144,21 +175,24 @@ partial void ProcessPostInternalTestingResponseContent( __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(xTestHeader ?? string.Empty), name: "\"X-Test-Header\""); - } + + } if (xTestHeader2 != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(xTestHeader2 ?? string.Empty), name: "\"X-Test-Header-2\""); - } + + } if (request.XPosition != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.XPosition, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"x_position\""); - } + + } if (request.ImageFile != default) { @@ -199,7 +233,8 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.AnotherImageFile != default) { @@ -240,67 +275,79 @@ request.AnotherImageFilename is null { __contentAnotherImageFile.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.SomeText != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.SomeText ?? string.Empty), name: "\"some_text\""); - } + + } if (request.NestedObject != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NestedObject.ToJson(JsonSerializerContext)), name: "\"nested_object\""); - } + + } if (request.NestedObjectRequiredFields != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.NestedObjectRequiredFields.ToJson(JsonSerializerContext)), name: "\"nested_object_required_fields\""); - } + + } if (request.DateTypeField != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.DateTypeField).HasValue ? (request.DateTypeField).GetValueOrDefault().ToString("yyyy-MM-dd") : string.Empty), name: "\"date_type_field\""); + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.RequiredDateTypeField.ToString("yyyy-MM-dd")), name: "\"required_date_type_field\""); + if (request.DateTimeTypeField != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.DateTimeTypeField).HasValue ? (request.DateTimeTypeField).GetValueOrDefault().ToString("yyyy-MM-ddTHH:mm:ssZ") : string.Empty), name: "\"date_time_type_field\""); - } + + } if (request.RepeatedPrimitiveField != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.RepeatedPrimitiveField, x => x))}]"), name: "\"repeated_primitive_field\""); - } + + } if (request.RepeatedComplexField != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.RepeatedComplexField, x => x.ToJson(JsonSerializerContext)))}]"), name: "\"repeated_complex_field\""); - } + + } if (request.EnumTypeField != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.EnumTypeField).HasValue ? (request.EnumTypeField).GetValueOrDefault().ToValueString() : string.Empty), name: "\"enum_type_field\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -344,6 +391,8 @@ request.AnotherImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -354,6 +403,11 @@ request.AnotherImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -371,6 +425,8 @@ request.AnotherImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -380,8 +436,7 @@ request.AnotherImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -390,6 +445,11 @@ request.AnotherImageFilename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -406,14 +466,15 @@ request.AnotherImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -453,6 +514,8 @@ request.AnotherImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -473,6 +536,8 @@ request.AnotherImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -497,23 +562,25 @@ request.AnotherImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.PostInternalTesting200Response.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostInternalTesting200Response.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -527,9 +594,13 @@ request.AnotherImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.PostInternalTesting200Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostInternalTesting200Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -546,17 +617,15 @@ request.AnotherImageFilename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.g.cs index 003e42a..027194f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.InternalTestingClient.g.cs @@ -62,6 +62,27 @@ public InternalTestingClient( { } + /// + /// Creates a new instance of the InternalTestingClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public InternalTestingClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the InternalTestingClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public InternalTestingClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public InternalTestingClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4.g.cs new file mode 100644 index 0000000..8a9b02a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class AspectRatioV4JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.AspectRatioV4 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::Ideogram.AspectRatioV4Extensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.AspectRatioV4)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.AspectRatioV4); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.AspectRatioV4 value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.AspectRatioV4Extensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4Nullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4Nullable.g.cs new file mode 100644 index 0000000..1db22e6 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.AspectRatioV4Nullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class AspectRatioV4NullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.AspectRatioV4? 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::Ideogram.AspectRatioV4Extensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.AspectRatioV4)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.AspectRatioV4?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.AspectRatioV4? 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::Ideogram.AspectRatioV4Extensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembers.g.cs index 6a5d9c1..b0ccf08 100644 --- a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembers.g.cs @@ -76,6 +76,7 @@ public class ColorPaletteWithPresetNameOrMembersJsonConverter : global::System.T { try { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.ColorPaletteWithPresetName), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.ColorPaletteWithPresetName).Name}"); colorPaletteWithPresetName = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); @@ -86,9 +87,13 @@ public class ColorPaletteWithPresetNameOrMembersJsonConverter : global::System.T catch (global::System.InvalidOperationException) { } + } + if (colorPaletteWithPresetName == null && colorPaletteWithMembers == null) + { try { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.ColorPaletteWithMembers), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.ColorPaletteWithMembers).Name}"); colorPaletteWithMembers = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModel.g.cs new file mode 100644 index 0000000..778ac81 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModel.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4ArtifactGenerationModelJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel 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::Ideogram.GenerateDesignRequestV4ArtifactGenerationModelExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModelExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelNullable.g.cs new file mode 100644 index 0000000..f12177f --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4ArtifactGenerationModelNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? 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::Ideogram.GenerateDesignRequestV4ArtifactGenerationModelExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? 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::Ideogram.GenerateDesignRequestV4ArtifactGenerationModelExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModel.g.cs new file mode 100644 index 0000000..4890853 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModel.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4InspirationReferenceModelJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel 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::Ideogram.GenerateDesignRequestV4InspirationReferenceModelExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerateDesignRequestV4InspirationReferenceModelExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelNullable.g.cs new file mode 100644 index 0000000..bf54d35 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4InspirationReferenceModelNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? 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::Ideogram.GenerateDesignRequestV4InspirationReferenceModelExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? 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::Ideogram.GenerateDesignRequestV4InspirationReferenceModelExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariant.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariant.g.cs new file mode 100644 index 0000000..c5ef7b1 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariant.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4Layout2imageVariantJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4Layout2imageVariant 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::Ideogram.GenerateDesignRequestV4Layout2imageVariantExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4Layout2imageVariant)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4Layout2imageVariant); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerateDesignRequestV4Layout2imageVariantExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantNullable.g.cs new file mode 100644 index 0000000..3484eb7 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4Layout2imageVariantNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? 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::Ideogram.GenerateDesignRequestV4Layout2imageVariantExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4Layout2imageVariant)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4Layout2imageVariant?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? 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::Ideogram.GenerateDesignRequestV4Layout2imageVariantExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseType.g.cs new file mode 100644 index 0000000..e8f7058 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4ResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4ResponseType 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::Ideogram.GenerateDesignRequestV4ResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4ResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4ResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerateDesignRequestV4ResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeNullable.g.cs new file mode 100644 index 0000000..45f8763 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateDesignRequestV4ResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateDesignRequestV4ResponseType? 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::Ideogram.GenerateDesignRequestV4ResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateDesignRequestV4ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateDesignRequestV4ResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateDesignRequestV4ResponseType? 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::Ideogram.GenerateDesignRequestV4ResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersion.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersion.g.cs new file mode 100644 index 0000000..f258cc9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersion.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateImageRequestV4StableVersionJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateImageRequestV4StableVersion 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::Ideogram.GenerateImageRequestV4StableVersionExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateImageRequestV4StableVersion)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateImageRequestV4StableVersion); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateImageRequestV4StableVersion value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerateImageRequestV4StableVersionExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersionNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersionNullable.g.cs new file mode 100644 index 0000000..e92b11a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerateImageRequestV4StableVersionNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerateImageRequestV4StableVersionNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerateImageRequestV4StableVersion? 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::Ideogram.GenerateImageRequestV4StableVersionExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerateImageRequestV4StableVersion)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerateImageRequestV4StableVersion?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerateImageRequestV4StableVersion? 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::Ideogram.GenerateImageRequestV4StableVersionExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseType.g.cs new file mode 100644 index 0000000..3fe29bf --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerationResponseResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerationResponseResponseType 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::Ideogram.GenerationResponseResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerationResponseResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerationResponseResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerationResponseResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerationResponseResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseTypeNullable.g.cs new file mode 100644 index 0000000..e1a1f08 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerationResponseResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerationResponseResponseType? 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::Ideogram.GenerationResponseResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerationResponseResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerationResponseResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerationResponseResponseType? 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::Ideogram.GenerationResponseResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatus.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatus.g.cs new file mode 100644 index 0000000..a07642a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatus.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerationResponseStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerationResponseStatus 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::Ideogram.GenerationResponseStatusExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerationResponseStatus)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerationResponseStatus); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerationResponseStatus value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.GenerationResponseStatusExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatusNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatusNullable.g.cs new file mode 100644 index 0000000..e59ad84 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.GenerationResponseStatusNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class GenerationResponseStatusNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.GenerationResponseStatus? 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::Ideogram.GenerationResponseStatusExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.GenerationResponseStatus)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.GenerationResponseStatus?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.GenerationResponseStatus? 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::Ideogram.GenerationResponseStatusExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseType.g.cs new file mode 100644 index 0000000..8a5015e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4ImageToImageResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType 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::Ideogram.ImageGenerationResponseV4ImageToImageResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.ImageGenerationResponseV4ImageToImageResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeNullable.g.cs new file mode 100644 index 0000000..63b490c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4ImageToImageResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType? 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::Ideogram.ImageGenerationResponseV4ImageToImageResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType? 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::Ideogram.ImageGenerationResponseV4ImageToImageResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseType.g.cs new file mode 100644 index 0000000..b70dfbf --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4LayoutResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4LayoutResponseType 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::Ideogram.ImageGenerationResponseV4LayoutResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4LayoutResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4LayoutResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4LayoutResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.ImageGenerationResponseV4LayoutResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeNullable.g.cs new file mode 100644 index 0000000..2feb378 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4LayoutResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4LayoutResponseType? 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::Ideogram.ImageGenerationResponseV4LayoutResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4LayoutResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4LayoutResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4LayoutResponseType? 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::Ideogram.ImageGenerationResponseV4LayoutResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseType.g.cs new file mode 100644 index 0000000..7b280c8 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4ResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4ResponseType 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::Ideogram.ImageGenerationResponseV4ResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4ResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4ResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.ImageGenerationResponseV4ResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeNullable.g.cs new file mode 100644 index 0000000..7d47905 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ImageGenerationResponseV4ResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ImageGenerationResponseV4ResponseType? 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::Ideogram.ImageGenerationResponseV4ResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ImageGenerationResponseV4ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ImageGenerationResponseV4ResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ImageGenerationResponseV4ResponseType? 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::Ideogram.ImageGenerationResponseV4ResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseType.g.cs new file mode 100644 index 0000000..6c26129 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class LayeredImageGenerationResponseV3ResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.LayeredImageGenerationResponseV3ResponseType 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::Ideogram.LayeredImageGenerationResponseV3ResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.LayeredImageGenerationResponseV3ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.LayeredImageGenerationResponseV3ResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.LayeredImageGenerationResponseV3ResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.LayeredImageGenerationResponseV3ResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeNullable.g.cs new file mode 100644 index 0000000..efc4cb2 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class LayeredImageGenerationResponseV3ResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.LayeredImageGenerationResponseV3ResponseType? 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::Ideogram.LayeredImageGenerationResponseV3ResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.LayeredImageGenerationResponseV3ResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.LayeredImageGenerationResponseV3ResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.LayeredImageGenerationResponseV3ResponseType? 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::Ideogram.LayeredImageGenerationResponseV3ResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRole.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRole.g.cs new file mode 100644 index 0000000..d7bc658 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRole.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class MagicPromptRequestMessagesInnerRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.MagicPromptRequestMessagesInnerRole 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::Ideogram.MagicPromptRequestMessagesInnerRoleExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.MagicPromptRequestMessagesInnerRole)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.MagicPromptRequestMessagesInnerRole); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.MagicPromptRequestMessagesInnerRole value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.MagicPromptRequestMessagesInnerRoleExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleNullable.g.cs new file mode 100644 index 0000000..c9dff85 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class MagicPromptRequestMessagesInnerRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.MagicPromptRequestMessagesInnerRole? 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::Ideogram.MagicPromptRequestMessagesInnerRoleExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.MagicPromptRequestMessagesInnerRole)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.MagicPromptRequestMessagesInnerRole?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.MagicPromptRequestMessagesInnerRole? 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::Ideogram.MagicPromptRequestMessagesInnerRoleExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200Response.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200Response.g.cs new file mode 100644 index 0000000..bd42d4d --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200Response.g.cs @@ -0,0 +1,72 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Ideogram.JsonConverters +{ + /// + public class PostGenerateDesignV4200ResponseJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.PostGenerateDesignV4200Response Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Ideogram.LayeredImageGenerationResponseV3? layered = default; + if (discriminator?.ResponseType == global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType.Layered) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.LayeredImageGenerationResponseV3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.LayeredImageGenerationResponseV3)}"); + layered = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Ideogram.ImageGenerationResponseV4Layout? url = default; + if (discriminator?.ResponseType == global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType.Url) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.ImageGenerationResponseV4Layout), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.ImageGenerationResponseV4Layout)}"); + url = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var __value = new global::Ideogram.PostGenerateDesignV4200Response( + discriminator?.ResponseType, + layered, + + url + ); + + return __value; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.PostGenerateDesignV4200Response value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsLayered) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.LayeredImageGenerationResponseV3), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.LayeredImageGenerationResponseV3).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Layered!, typeInfo); + } + else if (value.IsUrl) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.ImageGenerationResponseV4Layout), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.ImageGenerationResponseV4Layout).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Url!, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs new file mode 100644 index 0000000..41cc9c8 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class PostGenerateDesignV4200ResponseDiscriminatorResponseTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType 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::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeNullable.g.cs new file mode 100644 index 0000000..2a1e399 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class PostGenerateDesignV4200ResponseDiscriminatorResponseTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? 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::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? 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::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImage.g.cs new file mode 100644 index 0000000..333cd0f --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImage.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ResolutionV4ImageToImageJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ResolutionV4ImageToImage 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::Ideogram.ResolutionV4ImageToImageExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ResolutionV4ImageToImage)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ResolutionV4ImageToImage); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ResolutionV4ImageToImage value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.ResolutionV4ImageToImageExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImageNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImageNullable.g.cs new file mode 100644 index 0000000..fe10bdc --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4ImageToImageNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ResolutionV4ImageToImageNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ResolutionV4ImageToImage? 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::Ideogram.ResolutionV4ImageToImageExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ResolutionV4ImageToImage)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ResolutionV4ImageToImage?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ResolutionV4ImageToImage? 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::Ideogram.ResolutionV4ImageToImageExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4Layout.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4Layout.g.cs new file mode 100644 index 0000000..9bb35e2 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4Layout.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ResolutionV4LayoutJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ResolutionV4Layout 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::Ideogram.ResolutionV4LayoutExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ResolutionV4Layout)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ResolutionV4Layout); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ResolutionV4Layout value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.ResolutionV4LayoutExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4LayoutNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4LayoutNullable.g.cs new file mode 100644 index 0000000..5169304 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.ResolutionV4LayoutNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class ResolutionV4LayoutNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.ResolutionV4Layout? 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::Ideogram.ResolutionV4LayoutExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.ResolutionV4Layout)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.ResolutionV4Layout?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.ResolutionV4Layout? 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::Ideogram.ResolutionV4LayoutExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransform.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransform.g.cs new file mode 100644 index 0000000..dc997b1 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransform.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class TextItemV3TextTransformJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.TextItemV3TextTransform 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::Ideogram.TextItemV3TextTransformExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.TextItemV3TextTransform)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.TextItemV3TextTransform); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.TextItemV3TextTransform value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.TextItemV3TextTransformExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransformNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransformNullable.g.cs new file mode 100644 index 0000000..6ed0026 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3TextTransformNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class TextItemV3TextTransformNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.TextItemV3TextTransform? 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::Ideogram.TextItemV3TextTransformExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.TextItemV3TextTransform)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.TextItemV3TextTransform?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.TextItemV3TextTransform? 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::Ideogram.TextItemV3TextTransformExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignment.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignment.g.cs new file mode 100644 index 0000000..8ab6b11 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignment.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class TextItemV3VerticalAlignmentJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.TextItemV3VerticalAlignment 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::Ideogram.TextItemV3VerticalAlignmentExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.TextItemV3VerticalAlignment)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.TextItemV3VerticalAlignment); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.TextItemV3VerticalAlignment value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.TextItemV3VerticalAlignmentExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignmentNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignmentNullable.g.cs new file mode 100644 index 0000000..d0aea15 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.TextItemV3VerticalAlignmentNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class TextItemV3VerticalAlignmentNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.TextItemV3VerticalAlignment? 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::Ideogram.TextItemV3VerticalAlignmentExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.TextItemV3VerticalAlignment)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.TextItemV3VerticalAlignment?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.TextItemV3VerticalAlignment? 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::Ideogram.TextItemV3VerticalAlignmentExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementType.g.cs new file mode 100644 index 0000000..4c7b400 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4ObjPromptElementTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4ObjPromptElementType 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::Ideogram.V4ObjPromptElementTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4ObjPromptElementType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4ObjPromptElementType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4ObjPromptElementType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.V4ObjPromptElementTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementTypeNullable.g.cs new file mode 100644 index 0000000..cd930a2 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4ObjPromptElementTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4ObjPromptElementTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4ObjPromptElementType? 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::Ideogram.V4ObjPromptElementTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4ObjPromptElementType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4ObjPromptElementType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4ObjPromptElementType? 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::Ideogram.V4ObjPromptElementTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElement.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElement.g.cs new file mode 100644 index 0000000..a211de9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElement.g.cs @@ -0,0 +1,72 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Ideogram.JsonConverters +{ + /// + public class V4PromptElementJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4PromptElement Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.V4PromptElementDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.V4PromptElementDiscriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Ideogram.V4ObjPromptElement? obj = default; + if (discriminator?.Type == global::Ideogram.V4PromptElementDiscriminatorType.Obj) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.V4ObjPromptElement), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.V4ObjPromptElement)}"); + obj = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Ideogram.V4TextPromptElement? text = default; + if (discriminator?.Type == global::Ideogram.V4PromptElementDiscriminatorType.Text) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.V4TextPromptElement), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Ideogram.V4TextPromptElement)}"); + text = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var __value = new global::Ideogram.V4PromptElement( + discriminator?.Type, + obj, + + text + ); + + return __value; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4PromptElement value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsObj) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.V4ObjPromptElement), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.V4ObjPromptElement).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Obj!, typeInfo); + } + else if (value.IsText) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ideogram.V4TextPromptElement), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ideogram.V4TextPromptElement).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Text!, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorType.g.cs new file mode 100644 index 0000000..ef70bc5 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4PromptElementDiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4PromptElementDiscriminatorType 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::Ideogram.V4PromptElementDiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4PromptElementDiscriminatorType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4PromptElementDiscriminatorType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4PromptElementDiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.V4PromptElementDiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..2a0952e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4PromptElementDiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4PromptElementDiscriminatorType? 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::Ideogram.V4PromptElementDiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4PromptElementDiscriminatorType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4PromptElementDiscriminatorType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4PromptElementDiscriminatorType? 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::Ideogram.V4PromptElementDiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementType.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementType.g.cs new file mode 100644 index 0000000..b1ffa03 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4TextPromptElementTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4TextPromptElementType 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::Ideogram.V4TextPromptElementTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4TextPromptElementType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4TextPromptElementType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4TextPromptElementType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ideogram.V4TextPromptElementTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementTypeNullable.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementTypeNullable.g.cs new file mode 100644 index 0000000..8e9574c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.JsonConverters.V4TextPromptElementTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ideogram.JsonConverters +{ + /// + public sealed class V4TextPromptElementTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ideogram.V4TextPromptElementType? 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::Ideogram.V4TextPromptElementTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ideogram.V4TextPromptElementType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ideogram.V4TextPromptElementType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ideogram.V4TextPromptElementType? 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::Ideogram.V4TextPromptElementTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContext.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContext.g.cs index a21e406..44338a1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContext.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContext.g.cs @@ -13,13 +13,53 @@ namespace Ideogram DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Converters = new global::System.Type[] { + typeof(global::Ideogram.JsonConverters.GenerateImageRequestV4StableVersionJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateImageRequestV4StableVersionNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.InternalTestingEnumFieldJsonConverter), typeof(global::Ideogram.JsonConverters.InternalTestingEnumFieldNullableJsonConverter), - typeof(global::Ideogram.JsonConverters.MagicPromptVersionEnumJsonConverter), + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeJsonConverter), - typeof(global::Ideogram.JsonConverters.MagicPromptVersionEnumNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerationResponseStatusJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerationResponseStatusNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerationResponseResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.GenerationResponseResponseTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeNullableJsonConverter), typeof(global::Ideogram.JsonConverters.ModelEnumJsonConverter), @@ -41,6 +81,14 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.TextItemV3GlyphTypeNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.TextItemV3TextTransformJsonConverter), + + typeof(global::Ideogram.JsonConverters.TextItemV3TextTransformNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.TextItemV3VerticalAlignmentJsonConverter), + + typeof(global::Ideogram.JsonConverters.TextItemV3VerticalAlignmentNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.DetectedTextBlockAlignmentJsonConverter), typeof(global::Ideogram.JsonConverters.DetectedTextBlockAlignmentNullableJsonConverter), @@ -53,6 +101,10 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.DetectedTextBlockRoleNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.ApiKeyStatusJsonConverter), + + typeof(global::Ideogram.JsonConverters.ApiKeyStatusNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.ToolTypeJsonConverter), typeof(global::Ideogram.JsonConverters.ToolTypeNullableJsonConverter), @@ -77,10 +129,6 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.ApiProfileRoleNullableJsonConverter), - typeof(global::Ideogram.JsonConverters.ApiKeyStatusJsonConverter), - - typeof(global::Ideogram.JsonConverters.ApiKeyStatusNullableJsonConverter), - typeof(global::Ideogram.JsonConverters.InvoiceStatusJsonConverter), typeof(global::Ideogram.JsonConverters.InvoiceStatusNullableJsonConverter), @@ -97,10 +145,38 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.TrainingRunStatusNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.V4ObjPromptElementTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.V4ObjPromptElementTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.V4TextPromptElementTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.V4TextPromptElementTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter), + + typeof(global::Ideogram.JsonConverters.ResolutionV4NullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter), + + typeof(global::Ideogram.JsonConverters.RenderingSpeedNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter), typeof(global::Ideogram.JsonConverters.MagicPromptOptionNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.ResolutionV4ImageToImageJsonConverter), + + typeof(global::Ideogram.JsonConverters.ResolutionV4ImageToImageNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.ResolutionV4LayoutJsonConverter), + + typeof(global::Ideogram.JsonConverters.ResolutionV4LayoutNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.DescribeModelVersionJsonConverter), typeof(global::Ideogram.JsonConverters.DescribeModelVersionNullableJsonConverter), @@ -117,10 +193,6 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.AspectRatioV3NullableJsonConverter), - typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter), - - typeof(global::Ideogram.JsonConverters.RenderingSpeedNullableJsonConverter), - typeof(global::Ideogram.JsonConverters.ColorPalettePresetNameJsonConverter), typeof(global::Ideogram.JsonConverters.ColorPalettePresetNameNullableJsonConverter), @@ -145,33 +217,67 @@ namespace Ideogram typeof(global::Ideogram.JsonConverters.AspectRatioNullableJsonConverter), - typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter), + typeof(global::Ideogram.JsonConverters.MagicPromptVersionEnumJsonConverter), - typeof(global::Ideogram.JsonConverters.ResolutionV4NullableJsonConverter), + typeof(global::Ideogram.JsonConverters.MagicPromptVersionEnumNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.AspectRatioV4JsonConverter), + + typeof(global::Ideogram.JsonConverters.AspectRatioV4NullableJsonConverter), typeof(global::Ideogram.JsonConverters.AssetTypeJsonConverter), typeof(global::Ideogram.JsonConverters.AssetTypeNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeJsonConverter), + + typeof(global::Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeNullableJsonConverter), + + typeof(global::Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleJsonConverter), + + typeof(global::Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.ListCustomModelsScopeJsonConverter), typeof(global::Ideogram.JsonConverters.ListCustomModelsScopeNullableJsonConverter), + typeof(global::Ideogram.JsonConverters.V4PromptElementJsonConverter), + typeof(global::Ideogram.JsonConverters.ColorPaletteWithPresetNameOrMembersJsonConverter), + typeof(global::Ideogram.JsonConverters.PostGenerateDesignV4200ResponseJsonConverter), + typeof(global::Ideogram.JsonConverters.UnixTimestampJsonConverter), })] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.JsonSerializerContextTypes))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageRequestV4))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(string))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4JsonPrompt))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(int))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ResolutionV4), TypeInfoPropertyName = "ResolutionV42")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RenderingSpeed), TypeInfoPropertyName = "RenderingSpeed2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageRequestV4Stable))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageRequestV4StableVersion), TypeInfoPropertyName = "GenerateImageRequestV4StableVersion2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageRequestV4Im2Im))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(byte[]))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptOption), TypeInfoPropertyName = "MagicPromptOption2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ResolutionV4ImageToImage), TypeInfoPropertyName = "ResolutionV4ImageToImage2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemixImageRequestV4))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV4))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ResolutionV4Layout), TypeInfoPropertyName = "ResolutionV4Layout2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel), TypeInfoPropertyName = "GenerateDesignRequestV4InspirationReferenceModel2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel), TypeInfoPropertyName = "GenerateDesignRequestV4ArtifactGenerationModel2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV4Layout2imageVariant), TypeInfoPropertyName = "GenerateDesignRequestV4Layout2imageVariant2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV4ResponseType), TypeInfoPropertyName = "GenerateDesignRequestV4ResponseType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.DescribeResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.Description))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.DescribeRequest))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(byte[]))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.DescribeModelVersion), TypeInfoPropertyName = "DescribeModelVersion2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.DescribeRequestV4))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.DescribeResponseV4))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.EditImageRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ModelEnum), TypeInfoPropertyName = "ModelEnum2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.StyleType), TypeInfoPropertyName = "StyleType2")] @@ -180,12 +286,10 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ResolutionV3), TypeInfoPropertyName = "ResolutionV32")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.AspectRatioV3), TypeInfoPropertyName = "AspectRatioV32")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RenderingSpeed), TypeInfoPropertyName = "RenderingSpeed2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ColorPaletteWithPresetNameOrMembers), TypeInfoPropertyName = "ColorPaletteWithPresetNameOrMembers2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.StyleTypeV3), TypeInfoPropertyName = "StyleTypeV32")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.StylePresetV3), TypeInfoPropertyName = "StylePresetV32")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateGraphicRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateDesignRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayerizeDesignRequestV3))] @@ -194,14 +298,17 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemixImageRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.EditImageRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V1EditImagesRequest))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TryOnRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ReframeImageRequestV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ReplaceBackgroundRequestV3))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemoveBackgroundRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemoveBackgroundResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemoveBackgroundImageObject))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalTestingRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalTestingNestedObject))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalTestingNestedObjectRequiredFields))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalTestingEnumField), TypeInfoPropertyName = "InternalTestingEnumField2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RemixImageRequest))] @@ -222,19 +329,40 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V1EditImageObject))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4ResponseType), TypeInfoPropertyName = "ImageGenerationResponseV4ResponseType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationObjectV4))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ResolutionV4), TypeInfoPropertyName = "ResolutionV42")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.AsyncImageGenerationResponseV4))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerationResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerationResponseStatus), TypeInfoPropertyName = "GenerationResponseStatus2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerationResponseResponseType), TypeInfoPropertyName = "GenerationResponseResponseType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationObject))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4ImageToImage))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType), TypeInfoPropertyName = "ImageGenerationResponseV4ImageToImageResponseType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationObjectV4ImageToImage))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4Layout))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationResponseV4LayoutResponseType), TypeInfoPropertyName = "ImageGenerationResponseV4LayoutResponseType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageGenerationObjectV4Layout))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayeredImageGenerationObjectV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextContainerV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageLayerV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayeredImageGenerationResponseV3))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayeredImageGenerationResponseV3ResponseType), TypeInfoPropertyName = "LayeredImageGenerationResponseV3ResponseType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GenerateImageSafetyError))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(float))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptRequestMessagesInner))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptV4Request))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.AspectRatioV4), TypeInfoPropertyName = "AspectRatioV42")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptV4Response))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalBatchRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.SamplingRequestParams))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalBatchResponse))] @@ -243,9 +371,12 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextSpanV3FontFxItem), TypeInfoPropertyName = "TextSpanV3FontFxItem2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3Alignment), TypeInfoPropertyName = "TextItemV3Alignment2")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(float))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3StyleClass), TypeInfoPropertyName = "TextItemV3StyleClass2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3GlyphType), TypeInfoPropertyName = "TextItemV3GlyphType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3TextTransform), TypeInfoPropertyName = "TextItemV3TextTransform2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TextItemV3VerticalAlignment), TypeInfoPropertyName = "TextItemV3VerticalAlignment2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayeredAssetTextShadow))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.LayerizeTextRequest))] @@ -260,6 +391,9 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InternalBatchResultsResponseResultsInner))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ImageSafetyError))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.WebhookSigningJwks))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.WebhookSigningJwk))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ManageApiSubscriptionResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MetronomeLinks))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RechargeSettingsResponse))] @@ -268,12 +402,20 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiSubscriptionResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiSubscriptionError))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiSubscriptionRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ManageApiCreditSummaryResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.CreditGrant))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiReactivateResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GetApiKeysResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.RedactedApiKey))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiKeyResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.CreateApiKeyRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiProfileApiKey))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiKeyStatus), TypeInfoPropertyName = "ApiKeyStatus2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PatchApiKeyRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ManageApiStripeSubscriptionResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ManageApiPaymentResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GetApiTermsResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiTerms))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostApiTermsRequest))] @@ -299,8 +441,8 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiProfileType), TypeInfoPropertyName = "ApiProfileType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiProfileRole), TypeInfoPropertyName = "ApiProfileRole2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiProfileApiKey))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiKeyStatus), TypeInfoPropertyName = "ApiKeyStatus2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.UpdateOrganizationApiPropertiesResponse))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.UpdateOrganizationApiPropertiesRequest))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GetApiOrganizationUserSuggestionsResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ApiOrganizationUserSuggestion))] @@ -323,6 +465,7 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InvoiceStatus), TypeInfoPropertyName = "InvoiceStatus2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.InvoiceLineItem))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GetOrganizationBillingPortalResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ListDatasetsResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.Dataset))] @@ -352,34 +495,57 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.GetModelResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TrainModelV3Request))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.TrainModelV3AdvancedRequest))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4StyleDescription))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4CompositionalDeconstruction))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4PromptElement), TypeInfoPropertyName = "V4PromptElement2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4ObjPromptElement))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4TextPromptElement))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4PromptElementDiscriminator))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4PromptElementDiscriminatorType), TypeInfoPropertyName = "V4PromptElementDiscriminatorType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4ObjPromptElementType), TypeInfoPropertyName = "V4ObjPromptElementType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.V4TextPromptElementType), TypeInfoPropertyName = "V4TextPromptElementType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ColorPaletteWithPresetName))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ColorPaletteWithMembers))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ColorPalettePresetName), TypeInfoPropertyName = "ColorPalettePresetName2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ColorPaletteMember))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.AssetType), TypeInfoPropertyName = "AssetType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostGenerateDesignV4200Response), TypeInfoPropertyName = "PostGenerateDesignV4200Response2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType), TypeInfoPropertyName = "PostGenerateDesignV4200ResponseDiscriminatorResponseType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.PostInternalTesting200Response))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.MagicPromptRequestMessagesInnerRole), TypeInfoPropertyName = "MagicPromptRequestMessagesInnerRole2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ideogram.ListCustomModelsScope), TypeInfoPropertyName = "ListCustomModelsScope2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] @@ -398,6 +564,8 @@ namespace Ideogram [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] diff --git a/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContextTypes.g.cs b/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContextTypes.g.cs index 4f481c2..4f442c5 100644 --- a/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContextTypes.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.JsonSerializerContextTypes.g.cs @@ -36,955 +36,1275 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public int? Type2 { get; set; } + public global::Ideogram.V4JsonPrompt? Type2 { get; set; } /// /// /// - public global::Ideogram.MagicPromptOption? Type3 { get; set; } + public int? Type3 { get; set; } /// /// /// - public global::Ideogram.DescribeResponse? Type4 { get; set; } + public global::Ideogram.ResolutionV4? Type4 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type5 { get; set; } + public global::Ideogram.RenderingSpeed? Type5 { get; set; } /// /// /// - public global::Ideogram.Description? Type6 { get; set; } + public bool? Type6 { get; set; } /// /// /// - public global::Ideogram.DescribeRequest? Type7 { get; set; } + public global::Ideogram.GenerateImageRequestV4Stable? Type7 { get; set; } /// /// /// - public byte[]? Type8 { get; set; } + public global::Ideogram.GenerateImageRequestV4StableVersion? Type8 { get; set; } /// /// /// - public global::Ideogram.DescribeModelVersion? Type9 { get; set; } + public global::Ideogram.GenerateImageRequestV4Im2Im? Type9 { get; set; } /// /// /// - public global::Ideogram.EditImageRequest? Type10 { get; set; } + public byte[]? Type10 { get; set; } /// /// /// - public global::Ideogram.ModelEnum? Type11 { get; set; } + public global::Ideogram.MagicPromptOption? Type11 { get; set; } /// /// /// - public global::Ideogram.StyleType? Type12 { get; set; } + public global::Ideogram.ResolutionV4ImageToImage? Type12 { get; set; } /// /// /// - public global::Ideogram.GenerateImageRequest? Type13 { get; set; } + public global::Ideogram.RemixImageRequestV4? Type13 { get; set; } /// /// /// - public global::Ideogram.ImageRequest? Type14 { get; set; } + public global::Ideogram.GenerateDesignRequestV4? Type14 { get; set; } /// /// /// - public global::Ideogram.GenerateImageRequestV3? Type15 { get; set; } + public global::Ideogram.ResolutionV4Layout? Type15 { get; set; } /// /// /// - public global::Ideogram.ResolutionV3? Type16 { get; set; } + public global::System.Collections.Generic.IList? Type16 { get; set; } /// /// /// - public global::Ideogram.AspectRatioV3? Type17 { get; set; } + public global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? Type17 { get; set; } /// /// /// - public global::Ideogram.RenderingSpeed? Type18 { get; set; } + public global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? Type18 { get; set; } /// /// /// - public global::Ideogram.ColorPaletteWithPresetNameOrMembers? Type19 { get; set; } + public global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? Type19 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type20 { get; set; } + public global::Ideogram.GenerateDesignRequestV4ResponseType? Type20 { get; set; } /// /// /// - public global::Ideogram.StyleTypeV3? Type21 { get; set; } + public global::Ideogram.DescribeResponse? Type21 { get; set; } /// /// /// - public global::Ideogram.StylePresetV3? Type22 { get; set; } + public global::System.Collections.Generic.IList? Type22 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type23 { get; set; } + public global::Ideogram.Description? Type23 { get; set; } /// /// /// - public global::Ideogram.GenerateGraphicRequestV3? Type24 { get; set; } + public global::Ideogram.DescribeRequest? Type24 { get; set; } /// /// /// - public global::Ideogram.GenerateDesignRequestV3? Type25 { get; set; } + public global::Ideogram.DescribeModelVersion? Type25 { get; set; } /// /// /// - public global::Ideogram.LayerizeDesignRequestV3? Type26 { get; set; } + public global::Ideogram.DescribeRequestV4? Type26 { get; set; } /// /// /// - public global::Ideogram.GenerateTransparentImageRequestV3? Type27 { get; set; } + public global::Ideogram.DescribeResponseV4? Type27 { get; set; } /// /// /// - public global::Ideogram.UpscaleFactor? Type28 { get; set; } + public global::Ideogram.EditImageRequest? Type28 { get; set; } /// /// /// - public global::Ideogram.RemixImageRequestV3? Type29 { get; set; } + public global::Ideogram.ModelEnum? Type29 { get; set; } /// /// /// - public global::Ideogram.EditImageRequestV3? Type30 { get; set; } + public global::Ideogram.StyleType? Type30 { get; set; } /// /// /// - public global::Ideogram.V1EditImagesRequest? Type31 { get; set; } + public global::Ideogram.GenerateImageRequest? Type31 { get; set; } /// /// /// - public bool? Type32 { get; set; } + public global::Ideogram.ImageRequest? Type32 { get; set; } /// /// /// - public global::Ideogram.TryOnRequestV3? Type33 { get; set; } + public global::Ideogram.GenerateImageRequestV3? Type33 { get; set; } /// /// /// - public global::Ideogram.ReframeImageRequestV3? Type34 { get; set; } + public global::Ideogram.ResolutionV3? Type34 { get; set; } /// /// /// - public global::Ideogram.ReplaceBackgroundRequestV3? Type35 { get; set; } + public global::Ideogram.AspectRatioV3? Type35 { get; set; } /// /// /// - public global::Ideogram.InternalTestingRequest? Type36 { get; set; } + public global::Ideogram.ColorPaletteWithPresetNameOrMembers? Type36 { get; set; } /// /// /// - public global::Ideogram.InternalTestingNestedObject? Type37 { get; set; } + public global::System.Collections.Generic.IList? Type37 { get; set; } /// /// /// - public global::Ideogram.InternalTestingNestedObjectRequiredFields? Type38 { get; set; } + public global::Ideogram.StyleTypeV3? Type38 { get; set; } /// /// /// - public global::System.DateTime? Type39 { get; set; } + public global::Ideogram.StylePresetV3? Type39 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type40 { get; set; } + public global::Ideogram.GenerateGraphicRequestV3? Type40 { get; set; } /// /// /// - public global::Ideogram.InternalTestingEnumField? Type41 { get; set; } + public global::Ideogram.GenerateDesignRequestV3? Type41 { get; set; } /// /// /// - public global::Ideogram.RemixImageRequest? Type42 { get; set; } + public global::Ideogram.LayerizeDesignRequestV3? Type42 { get; set; } /// /// /// - public global::Ideogram.InitialImageRequest? Type43 { get; set; } + public global::Ideogram.GenerateTransparentImageRequestV3? Type43 { get; set; } /// /// /// - public global::Ideogram.ReframeImageRequest? Type44 { get; set; } + public global::Ideogram.UpscaleFactor? Type44 { get; set; } /// /// /// - public global::Ideogram.Resolution? Type45 { get; set; } + public global::Ideogram.RemixImageRequestV3? Type45 { get; set; } /// /// /// - public global::Ideogram.UpscaleImageRequest? Type46 { get; set; } + public global::Ideogram.EditImageRequestV3? Type46 { get; set; } /// /// /// - public global::Ideogram.UpscaleInitialImageRequest? Type47 { get; set; } + public global::Ideogram.V1EditImagesRequest? Type47 { get; set; } /// /// /// - public global::Ideogram.AspectRatio? Type48 { get; set; } + public global::Ideogram.TryOnRequestV3? Type48 { get; set; } /// /// /// - public global::Ideogram.MagicPromptVersionEnum? Type49 { get; set; } + public global::Ideogram.ReframeImageRequestV3? Type49 { get; set; } /// /// /// - public global::Ideogram.GenerateImageResponse? Type50 { get; set; } + public global::Ideogram.ReplaceBackgroundRequestV3? Type50 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type51 { get; set; } + public global::Ideogram.RemoveBackgroundRequest? Type51 { get; set; } /// /// /// - public global::Ideogram.ImageObject? Type52 { get; set; } + public global::Ideogram.RemoveBackgroundResponse? Type52 { get; set; } /// /// /// - public global::Ideogram.ImageGenerationResponseV3? Type53 { get; set; } + public global::System.DateTime? Type53 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type54 { get; set; } + public global::System.Collections.Generic.IList? Type54 { get; set; } /// /// /// - public global::Ideogram.ImageGenerationObjectV3? Type55 { get; set; } + public global::Ideogram.RemoveBackgroundImageObject? Type55 { get; set; } /// /// /// - public global::Ideogram.V1EditImagesResponse? Type56 { get; set; } + public global::Ideogram.InternalTestingRequest? Type56 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type57 { get; set; } + public global::Ideogram.InternalTestingNestedObject? Type57 { get; set; } /// /// /// - public global::Ideogram.V1EditImageObject? Type58 { get; set; } + public global::Ideogram.InternalTestingNestedObjectRequiredFields? Type58 { get; set; } /// /// /// - public global::Ideogram.ImageGenerationResponseV4? Type59 { get; set; } + public global::System.Collections.Generic.IList? Type59 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type60 { get; set; } + public global::Ideogram.InternalTestingEnumField? Type60 { get; set; } /// /// /// - public global::Ideogram.ImageGenerationObjectV4? Type61 { get; set; } + public global::Ideogram.RemixImageRequest? Type61 { get; set; } /// /// /// - public global::Ideogram.ResolutionV4? Type62 { get; set; } + public global::Ideogram.InitialImageRequest? Type62 { get; set; } /// /// /// - public global::Ideogram.LayeredImageGenerationObjectV3? Type63 { get; set; } + public global::Ideogram.ReframeImageRequest? Type63 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type64 { get; set; } + public global::Ideogram.Resolution? Type64 { get; set; } /// /// /// - public global::Ideogram.TextContainerV3? Type65 { get; set; } + public global::Ideogram.UpscaleImageRequest? Type65 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type66 { get; set; } + public global::Ideogram.UpscaleInitialImageRequest? Type66 { get; set; } /// /// /// - public global::Ideogram.ImageLayerV3? Type67 { get; set; } + public global::Ideogram.AspectRatio? Type67 { get; set; } /// /// /// - public global::Ideogram.LayeredImageGenerationResponseV3? Type68 { get; set; } + public global::Ideogram.MagicPromptVersionEnum? Type68 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type69 { get; set; } + public global::Ideogram.GenerateImageResponse? Type69 { get; set; } /// /// /// - public global::Ideogram.GenerateImageSafetyError? Type70 { get; set; } + public global::System.Collections.Generic.IList? Type70 { get; set; } /// /// /// - public global::Ideogram.MagicPromptRequest? Type71 { get; set; } + public global::Ideogram.ImageObject? Type71 { get; set; } /// /// /// - public global::Ideogram.MagicPromptResponse? Type72 { get; set; } + public global::Ideogram.ImageGenerationResponseV3? Type72 { get; set; } /// /// /// - public global::Ideogram.InternalBatchRequest? Type73 { get; set; } + public global::System.Collections.Generic.IList? Type73 { get; set; } /// /// /// - public global::Ideogram.SamplingRequestParams? Type74 { get; set; } + public global::Ideogram.ImageGenerationObjectV3? Type74 { get; set; } /// /// /// - public global::Ideogram.InternalBatchResponse? Type75 { get; set; } + public global::Ideogram.V1EditImagesResponse? Type75 { get; set; } /// /// /// - public global::Ideogram.TextSpanV3? Type76 { get; set; } + public global::System.Collections.Generic.IList? Type76 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type77 { get; set; } + public global::Ideogram.V1EditImageObject? Type77 { get; set; } /// /// /// - public global::Ideogram.TextSpanV3FontFxItem? Type78 { get; set; } + public global::Ideogram.ImageGenerationResponseV4? Type78 { get; set; } /// /// /// - public global::Ideogram.TextItemV3? Type79 { get; set; } + public global::Ideogram.ImageGenerationResponseV4ResponseType? Type79 { get; set; } /// /// /// - public global::Ideogram.TextItemV3Alignment? Type80 { get; set; } + public global::System.Collections.Generic.IList? Type80 { get; set; } /// /// /// - public float? Type81 { get; set; } + public global::Ideogram.ImageGenerationObjectV4? Type81 { get; set; } /// /// /// - public global::Ideogram.TextItemV3StyleClass? Type82 { get; set; } + public global::Ideogram.AsyncImageGenerationResponseV4? Type82 { get; set; } /// /// /// - public global::Ideogram.TextItemV3GlyphType? Type83 { get; set; } + public global::Ideogram.GenerationResponse? Type83 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type84 { get; set; } + public global::Ideogram.GenerationResponseStatus? Type84 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type85 { get; set; } + public global::Ideogram.GenerationResponseResponseType? Type85 { get; set; } /// /// /// - public global::Ideogram.LayerizeTextRequest? Type86 { get; set; } + public global::System.Collections.Generic.IList? Type86 { get; set; } /// /// /// - public global::Ideogram.LayerizeTextResponse? Type87 { get; set; } + public global::Ideogram.ImageGenerationObject? Type87 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type88 { get; set; } + public global::Ideogram.ImageGenerationResponseV4ImageToImage? Type88 { get; set; } /// /// /// - public global::Ideogram.DetectedTextBlock? Type89 { get; set; } + public global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType? Type89 { get; set; } /// /// /// - public global::Ideogram.DetectedTextBlockAlignment? Type90 { get; set; } + public global::System.Collections.Generic.IList? Type90 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type91 { get; set; } + public global::Ideogram.ImageGenerationObjectV4ImageToImage? Type91 { get; set; } /// /// /// - public global::Ideogram.DetectedTextBlockFormattingItem? Type92 { get; set; } + public global::Ideogram.ImageGenerationResponseV4Layout? Type92 { get; set; } /// /// /// - public global::Ideogram.DetectedTextBlockRole? Type93 { get; set; } + public global::Ideogram.ImageGenerationResponseV4LayoutResponseType? Type93 { get; set; } /// /// /// - public global::Ideogram.InternalBatchResultsResponse? Type94 { get; set; } + public global::System.Collections.Generic.IList? Type94 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type95 { get; set; } + public global::Ideogram.ImageGenerationObjectV4Layout? Type95 { get; set; } /// /// /// - public global::Ideogram.InternalBatchResultsResponseResultsInner? Type96 { get; set; } + public global::Ideogram.LayeredImageGenerationObjectV3? Type96 { get; set; } /// /// /// - public global::Ideogram.ImageSafetyError? Type97 { get; set; } + public global::System.Collections.Generic.IList? Type97 { get; set; } /// /// /// - public global::Ideogram.ManageApiSubscriptionResponse? Type98 { get; set; } + public global::Ideogram.TextContainerV3? Type98 { get; set; } /// /// /// - public global::Ideogram.MetronomeLinks? Type99 { get; set; } + public global::System.Collections.Generic.IList? Type99 { get; set; } /// /// /// - public global::Ideogram.RechargeSettingsResponse? Type100 { get; set; } + public global::Ideogram.ImageLayerV3? Type100 { get; set; } /// /// /// - public global::Ideogram.Price? Type101 { get; set; } + public global::Ideogram.LayeredImageGenerationResponseV3? Type101 { get; set; } /// /// /// - public global::Ideogram.RechargeSettings? Type102 { get; set; } + public global::Ideogram.LayeredImageGenerationResponseV3ResponseType? Type102 { get; set; } /// /// /// - public global::Ideogram.PostApiSubscriptionResponse? Type103 { get; set; } + public global::System.Collections.Generic.IList? Type103 { get; set; } /// /// /// - public global::Ideogram.PostApiSubscriptionError? Type104 { get; set; } + public global::Ideogram.GenerateImageSafetyError? Type104 { get; set; } /// /// /// - public global::Ideogram.PostApiSubscriptionRequest? Type105 { get; set; } + public global::Ideogram.MagicPromptRequest? Type105 { get; set; } /// /// /// - public global::Ideogram.PostApiReactivateResponse? Type106 { get; set; } + public float? Type106 { get; set; } /// /// /// - public global::Ideogram.GetApiKeysResponse? Type107 { get; set; } + public global::System.Collections.Generic.IList? Type107 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type108 { get; set; } + public global::Ideogram.MagicPromptRequestMessagesInner? Type108 { get; set; } /// /// /// - public global::Ideogram.RedactedApiKey? Type109 { get; set; } + public global::Ideogram.MagicPromptResponse? Type109 { get; set; } /// /// /// - public global::Ideogram.PostApiKeyResponse? Type110 { get; set; } + public global::Ideogram.MagicPromptV4Request? Type110 { get; set; } /// /// /// - public global::Ideogram.ManageApiStripeSubscriptionResponse? Type111 { get; set; } + public global::Ideogram.AspectRatioV4? Type111 { get; set; } /// /// /// - public global::Ideogram.GetApiTermsResponse? Type112 { get; set; } + public global::Ideogram.MagicPromptV4Response? Type112 { get; set; } /// /// /// - public global::Ideogram.ApiTerms? Type113 { get; set; } + public global::Ideogram.InternalBatchRequest? Type113 { get; set; } /// /// /// - public global::Ideogram.PostApiTermsRequest? Type114 { get; set; } + public global::Ideogram.SamplingRequestParams? Type114 { get; set; } /// /// /// - public global::Ideogram.PostAddCreditsResponse? Type115 { get; set; } + public global::Ideogram.InternalBatchResponse? Type115 { get; set; } /// /// /// - public global::Ideogram.PostAddCreditsError? Type116 { get; set; } + public global::Ideogram.TextSpanV3? Type116 { get; set; } /// /// /// - public global::Ideogram.PostAddCreditsRequest? Type117 { get; set; } + public global::System.Collections.Generic.IList? Type117 { get; set; } /// /// /// - public global::Ideogram.GetUserCreditsResponse? Type118 { get; set; } + public global::Ideogram.TextSpanV3FontFxItem? Type118 { get; set; } /// /// /// - public global::Ideogram.SpendCommitInfoResponse? Type119 { get; set; } + public global::Ideogram.TextItemV3? Type119 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type120 { get; set; } + public global::Ideogram.TextItemV3Alignment? Type120 { get; set; } /// /// /// - public global::Ideogram.SpendCommitInfo? Type121 { get; set; } + public global::Ideogram.TextItemV3StyleClass? Type121 { get; set; } /// /// /// - public global::Ideogram.GetUsageInfoResponse? Type122 { get; set; } + public global::Ideogram.TextItemV3GlyphType? Type122 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type123 { get; set; } + public global::Ideogram.TextItemV3TextTransform? Type123 { get; set; } /// /// /// - public global::Ideogram.UsageSegment? Type124 { get; set; } + public global::Ideogram.TextItemV3VerticalAlignment? Type124 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type125 { get; set; } + public global::System.Collections.Generic.IList? Type125 { get; set; } /// /// /// - public global::Ideogram.ToolUsage? Type126 { get; set; } + public global::Ideogram.LayeredAssetTextShadow? Type126 { get; set; } /// /// /// - public global::Ideogram.ToolType? Type127 { get; set; } + public global::System.Collections.Generic.IList? Type127 { get; set; } /// /// /// - public global::Ideogram.ModelVersion? Type128 { get; set; } + public global::System.Collections.Generic.IList? Type128 { get; set; } /// /// /// - public global::Ideogram.SegmentBy? Type129 { get; set; } + public global::Ideogram.LayerizeTextRequest? Type129 { get; set; } /// /// /// - public global::Ideogram.UsageSource? Type130 { get; set; } + public global::Ideogram.LayerizeTextResponse? Type130 { get; set; } /// /// /// - public global::Ideogram.GetApiProfilesResponse? Type131 { get; set; } + public global::System.Collections.Generic.IList? Type131 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type132 { get; set; } + public global::Ideogram.DetectedTextBlock? Type132 { get; set; } /// /// /// - public global::Ideogram.ApiProfile? Type133 { get; set; } + public global::Ideogram.DetectedTextBlockAlignment? Type133 { get; set; } /// /// /// - public global::Ideogram.ApiProfileType? Type134 { get; set; } + public global::System.Collections.Generic.IList? Type134 { get; set; } /// /// /// - public global::Ideogram.ApiProfileRole? Type135 { get; set; } + public global::Ideogram.DetectedTextBlockFormattingItem? Type135 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type136 { get; set; } + public global::Ideogram.DetectedTextBlockRole? Type136 { get; set; } /// /// /// - public global::Ideogram.ApiProfileApiKey? Type137 { get; set; } + public global::Ideogram.InternalBatchResultsResponse? Type137 { get; set; } /// /// /// - public global::Ideogram.ApiKeyStatus? Type138 { get; set; } + public global::System.Collections.Generic.IList? Type138 { get; set; } /// /// /// - public global::Ideogram.GetApiOrganizationUserSuggestionsResponse? Type139 { get; set; } + public global::Ideogram.InternalBatchResultsResponseResultsInner? Type139 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type140 { get; set; } + public global::Ideogram.ImageSafetyError? Type140 { get; set; } /// /// /// - public global::Ideogram.ApiOrganizationUserSuggestion? Type141 { get; set; } + public global::Ideogram.WebhookSigningJwks? Type141 { get; set; } /// /// /// - public global::Ideogram.GetOrganizationMembersResponse? Type142 { get; set; } + public global::System.Collections.Generic.IList? Type142 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type143 { get; set; } + public global::Ideogram.WebhookSigningJwk? Type143 { get; set; } /// /// /// - public global::Ideogram.OrganizationMember? Type144 { get; set; } + public global::Ideogram.ManageApiSubscriptionResponse? Type144 { get; set; } /// /// /// - public global::Ideogram.CreateApiKeyResponse? Type145 { get; set; } + public global::Ideogram.MetronomeLinks? Type145 { get; set; } /// /// /// - public global::Ideogram.GetApiKeysV2Response? Type146 { get; set; } + public global::Ideogram.RechargeSettingsResponse? Type146 { get; set; } /// /// /// - public global::Ideogram.OrganizationMemberOperationResponse? Type147 { get; set; } + public global::Ideogram.Price? Type147 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type148 { get; set; } + public global::Ideogram.RechargeSettings? Type148 { get; set; } /// /// /// - public global::Ideogram.OrganizationMemberOperationResult? Type149 { get; set; } + public global::Ideogram.PostApiSubscriptionResponse? Type149 { get; set; } /// /// /// - public global::Ideogram.AddOrganizationMembersRequest? Type150 { get; set; } + public global::Ideogram.PostApiSubscriptionError? Type150 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type151 { get; set; } + public global::Ideogram.PostApiSubscriptionRequest? Type151 { get; set; } /// /// /// - public global::Ideogram.LiteOrganizationMember? Type152 { get; set; } + public global::Ideogram.ManageApiCreditSummaryResponse? Type152 { get; set; } /// /// /// - public global::Ideogram.RemoveOrganizationMembersRequest? Type153 { get; set; } + public global::System.Collections.Generic.IList? Type153 { get; set; } /// /// /// - public global::Ideogram.PromoteOrganizationMembersRequest? Type154 { get; set; } + public global::Ideogram.CreditGrant? Type154 { get; set; } /// /// /// - public global::Ideogram.ListOrganizationInvoicesResponse? Type155 { get; set; } + public global::Ideogram.PostApiReactivateResponse? Type155 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type156 { get; set; } + public global::Ideogram.GetApiKeysResponse? Type156 { get; set; } /// /// /// - public global::Ideogram.Invoice? Type157 { get; set; } + public global::System.Collections.Generic.IList? Type157 { get; set; } /// /// /// - public global::Ideogram.InvoiceStatus? Type158 { get; set; } + public global::Ideogram.RedactedApiKey? Type158 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type159 { get; set; } + public global::Ideogram.PostApiKeyResponse? Type159 { get; set; } /// /// /// - public global::Ideogram.InvoiceLineItem? Type160 { get; set; } + public global::Ideogram.CreateApiKeyRequest? Type160 { get; set; } /// /// /// - public global::Ideogram.ListDatasetsResponse? Type161 { get; set; } + public global::Ideogram.ApiProfileApiKey? Type161 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type162 { get; set; } + public global::Ideogram.ApiKeyStatus? Type162 { get; set; } /// /// /// - public global::Ideogram.Dataset? Type163 { get; set; } + public global::Ideogram.PatchApiKeyRequest? Type163 { get; set; } /// /// /// - public global::Ideogram.AssetIdentifier? Type164 { get; set; } + public global::Ideogram.ManageApiStripeSubscriptionResponse? Type164 { get; set; } /// /// /// - public global::Ideogram.CreateDatasetRequest? Type165 { get; set; } + public global::Ideogram.ManageApiPaymentResponse? Type165 { get; set; } /// /// /// - public global::Ideogram.GetDatasetResponse? Type166 { get; set; } + public global::Ideogram.GetApiTermsResponse? Type166 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type167 { get; set; } + public global::Ideogram.ApiTerms? Type167 { get; set; } /// /// /// - public global::Ideogram.DatasetFile? Type168 { get; set; } + public global::Ideogram.PostApiTermsRequest? Type168 { get; set; } /// /// /// - public long? Type169 { get; set; } + public global::Ideogram.PostAddCreditsResponse? Type169 { get; set; } /// /// /// - public global::Ideogram.UploadDatasetAssetsResponse? Type170 { get; set; } + public global::Ideogram.PostAddCreditsError? Type170 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type171 { get; set; } + public global::Ideogram.PostAddCreditsRequest? Type171 { get; set; } /// /// /// - public global::Ideogram.DatasetUploadSucceededAsset? Type172 { get; set; } + public global::Ideogram.GetUserCreditsResponse? Type172 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type173 { get; set; } + public global::Ideogram.SpendCommitInfoResponse? Type173 { get; set; } /// /// /// - public global::Ideogram.DatasetUploadFailedAsset? Type174 { get; set; } + public global::System.Collections.Generic.IList? Type174 { get; set; } /// /// /// - public global::Ideogram.DatasetAssetFailureReason? Type175 { get; set; } + public global::Ideogram.SpendCommitInfo? Type175 { get; set; } /// /// /// - public global::Ideogram.UploadDatasetAssetsRequest? Type176 { get; set; } + public global::Ideogram.GetUsageInfoResponse? Type176 { get; set; } /// /// /// - public global::Ideogram.TrainDatasetModelResponse? Type177 { get; set; } + public global::System.Collections.Generic.IList? Type177 { get; set; } /// /// /// - public global::Ideogram.TrainDatasetModelRequest? Type178 { get; set; } + public global::Ideogram.UsageSegment? Type178 { get; set; } /// /// /// - public global::Ideogram.ListModelsResponse? Type179 { get; set; } + public global::System.Collections.Generic.IList? Type179 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type180 { get; set; } + public global::Ideogram.ToolUsage? Type180 { get; set; } /// /// /// - public global::Ideogram.CustomModel? Type181 { get; set; } + public global::Ideogram.ToolType? Type181 { get; set; } /// /// /// - public global::Ideogram.ModelStatus? Type182 { get; set; } + public global::Ideogram.ModelVersion? Type182 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type183 { get; set; } + public global::Ideogram.SegmentBy? Type183 { get; set; } /// /// /// - public global::Ideogram.TrainingRun? Type184 { get; set; } + public global::Ideogram.UsageSource? Type184 { get; set; } /// /// /// - public global::Ideogram.TrainingRunStatus? Type185 { get; set; } + public global::Ideogram.GetApiProfilesResponse? Type185 { get; set; } /// /// /// - public double? Type186 { get; set; } + public global::System.Collections.Generic.IList? Type186 { get; set; } /// /// /// - public global::Ideogram.GetModelResponse? Type187 { get; set; } + public global::Ideogram.ApiProfile? Type187 { get; set; } /// /// /// - public global::Ideogram.TrainModelV3Request? Type188 { get; set; } + public global::Ideogram.ApiProfileType? Type188 { get; set; } /// /// /// - public global::Ideogram.TrainModelV3AdvancedRequest? Type189 { get; set; } + public global::Ideogram.ApiProfileRole? Type189 { get; set; } /// /// /// - public global::Ideogram.ColorPaletteWithPresetName? Type190 { get; set; } + public global::System.Collections.Generic.IList? Type190 { get; set; } /// /// /// - public global::Ideogram.ColorPaletteWithMembers? Type191 { get; set; } + public global::Ideogram.UpdateOrganizationApiPropertiesResponse? Type191 { get; set; } /// /// /// - public global::Ideogram.ColorPalettePresetName? Type192 { get; set; } + public global::Ideogram.UpdateOrganizationApiPropertiesRequest? Type192 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type193 { get; set; } + public global::Ideogram.GetApiOrganizationUserSuggestionsResponse? Type193 { get; set; } /// /// /// - public global::Ideogram.ColorPaletteMember? Type194 { get; set; } + public global::System.Collections.Generic.IList? Type194 { get; set; } /// /// /// - public global::Ideogram.AssetType? Type195 { get; set; } + public global::Ideogram.ApiOrganizationUserSuggestion? Type195 { get; set; } /// /// /// - public global::Ideogram.PostInternalTesting200Response? Type196 { get; set; } + public global::Ideogram.GetOrganizationMembersResponse? Type196 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type197 { get; set; } + public global::System.Collections.Generic.IList? Type197 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type198 { get; set; } + public global::Ideogram.OrganizationMember? Type198 { get; set; } /// /// /// - public global::Ideogram.ListCustomModelsScope? Type199 { get; set; } + public global::Ideogram.CreateApiKeyResponse? Type199 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type200 { get; set; } + public global::Ideogram.GetApiKeysV2Response? Type200 { get; set; } + /// + /// + /// + public global::Ideogram.OrganizationMemberOperationResponse? Type201 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type202 { get; set; } + /// + /// + /// + public global::Ideogram.OrganizationMemberOperationResult? Type203 { get; set; } + /// + /// + /// + public global::Ideogram.AddOrganizationMembersRequest? Type204 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type205 { get; set; } + /// + /// + /// + public global::Ideogram.LiteOrganizationMember? Type206 { get; set; } + /// + /// + /// + public global::Ideogram.RemoveOrganizationMembersRequest? Type207 { get; set; } + /// + /// + /// + public global::Ideogram.PromoteOrganizationMembersRequest? Type208 { get; set; } + /// + /// + /// + public global::Ideogram.ListOrganizationInvoicesResponse? Type209 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type210 { get; set; } + /// + /// + /// + public global::Ideogram.Invoice? Type211 { get; set; } + /// + /// + /// + public global::Ideogram.InvoiceStatus? Type212 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type213 { get; set; } + /// + /// + /// + public global::Ideogram.InvoiceLineItem? Type214 { get; set; } + /// + /// + /// + public global::Ideogram.GetOrganizationBillingPortalResponse? Type215 { get; set; } + /// + /// + /// + public global::Ideogram.ListDatasetsResponse? Type216 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type217 { get; set; } + /// + /// + /// + public global::Ideogram.Dataset? Type218 { get; set; } + /// + /// + /// + public global::Ideogram.AssetIdentifier? Type219 { get; set; } + /// + /// + /// + public global::Ideogram.CreateDatasetRequest? Type220 { get; set; } + /// + /// + /// + public global::Ideogram.GetDatasetResponse? Type221 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type222 { get; set; } + /// + /// + /// + public global::Ideogram.DatasetFile? Type223 { get; set; } + /// + /// + /// + public long? Type224 { get; set; } + /// + /// + /// + public global::Ideogram.UploadDatasetAssetsResponse? Type225 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type226 { get; set; } + /// + /// + /// + public global::Ideogram.DatasetUploadSucceededAsset? Type227 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type228 { get; set; } + /// + /// + /// + public global::Ideogram.DatasetUploadFailedAsset? Type229 { get; set; } + /// + /// + /// + public global::Ideogram.DatasetAssetFailureReason? Type230 { get; set; } + /// + /// + /// + public global::Ideogram.UploadDatasetAssetsRequest? Type231 { get; set; } + /// + /// + /// + public global::Ideogram.TrainDatasetModelResponse? Type232 { get; set; } + /// + /// + /// + public global::Ideogram.TrainDatasetModelRequest? Type233 { get; set; } + /// + /// + /// + public global::Ideogram.ListModelsResponse? Type234 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type235 { get; set; } + /// + /// + /// + public global::Ideogram.CustomModel? Type236 { get; set; } + /// + /// + /// + public global::Ideogram.ModelStatus? Type237 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type238 { get; set; } + /// + /// + /// + public global::Ideogram.TrainingRun? Type239 { get; set; } + /// + /// + /// + public global::Ideogram.TrainingRunStatus? Type240 { get; set; } + /// + /// + /// + public double? Type241 { get; set; } + /// + /// + /// + public global::Ideogram.GetModelResponse? Type242 { get; set; } + /// + /// + /// + public global::Ideogram.TrainModelV3Request? Type243 { get; set; } + /// + /// + /// + public global::Ideogram.TrainModelV3AdvancedRequest? Type244 { get; set; } + /// + /// + /// + public global::Ideogram.V4StyleDescription? Type245 { get; set; } + /// + /// + /// + public global::Ideogram.V4CompositionalDeconstruction? Type246 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type247 { get; set; } + /// + /// + /// + public global::Ideogram.V4PromptElement? Type248 { get; set; } + /// + /// + /// + public global::Ideogram.V4ObjPromptElement? Type249 { get; set; } + /// + /// + /// + public global::Ideogram.V4TextPromptElement? Type250 { get; set; } + /// + /// + /// + public global::Ideogram.V4PromptElementDiscriminator? Type251 { get; set; } + /// + /// + /// + public global::Ideogram.V4PromptElementDiscriminatorType? Type252 { get; set; } + /// + /// + /// + public global::Ideogram.V4ObjPromptElementType? Type253 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type254 { get; set; } + /// + /// + /// + public global::Ideogram.V4TextPromptElementType? Type255 { get; set; } + /// + /// + /// + public global::Ideogram.ColorPaletteWithPresetName? Type256 { get; set; } + /// + /// + /// + public global::Ideogram.ColorPaletteWithMembers? Type257 { get; set; } + /// + /// + /// + public global::Ideogram.ColorPalettePresetName? Type258 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type259 { get; set; } + /// + /// + /// + public global::Ideogram.ColorPaletteMember? Type260 { get; set; } + /// + /// + /// + public global::Ideogram.AssetType? Type261 { get; set; } + /// + /// + /// + public global::Ideogram.PostGenerateDesignV4200Response? Type262 { get; set; } + /// + /// + /// + public global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator? Type263 { get; set; } + /// + /// + /// + public global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? Type264 { get; set; } + /// + /// + /// + public global::Ideogram.PostInternalTesting200Response? Type265 { get; set; } + /// + /// + /// + public global::Ideogram.MagicPromptRequestMessagesInnerRole? Type266 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type267 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type268 { get; set; } + /// + /// + /// + public global::Ideogram.ListCustomModelsScope? Type269 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type270 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType0 { get; set; } + public global::System.Collections.Generic.List? ListType0 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType1 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType2 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType3 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType4 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType5 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType6 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType7 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType8 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType9 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType10 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType1 { get; set; } + public global::System.Collections.Generic.List? ListType11 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType2 { get; set; } + public global::System.Collections.Generic.List? ListType12 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType3 { get; set; } + public global::System.Collections.Generic.List? ListType13 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType4 { get; set; } + public global::System.Collections.Generic.List? ListType14 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType5 { get; set; } + public global::System.Collections.Generic.List? ListType15 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType6 { get; set; } + public global::System.Collections.Generic.List? ListType16 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType7 { get; set; } + public global::System.Collections.Generic.List? ListType17 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType8 { get; set; } + public global::System.Collections.Generic.List? ListType18 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType9 { get; set; } + public global::System.Collections.Generic.List? ListType19 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType10 { get; set; } + public global::System.Collections.Generic.List? ListType20 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType11 { get; set; } + public global::System.Collections.Generic.List? ListType21 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType12 { get; set; } + public global::System.Collections.Generic.List? ListType22 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType13 { get; set; } + public global::System.Collections.Generic.List? ListType23 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType14 { get; set; } + public global::System.Collections.Generic.List? ListType24 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType15 { get; set; } + public global::System.Collections.Generic.List? ListType25 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType16 { get; set; } + public global::System.Collections.Generic.List? ListType26 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType17 { get; set; } + public global::System.Collections.Generic.List? ListType27 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType18 { get; set; } + public global::System.Collections.Generic.List? ListType28 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType19 { get; set; } + public global::System.Collections.Generic.List? ListType29 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType20 { get; set; } + public global::System.Collections.Generic.List? ListType30 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType21 { get; set; } + public global::System.Collections.Generic.List? ListType31 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType22 { get; set; } + public global::System.Collections.Generic.List? ListType32 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType23 { get; set; } + public global::System.Collections.Generic.List? ListType33 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType24 { get; set; } + public global::System.Collections.Generic.List? ListType34 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType25 { get; set; } + public global::System.Collections.Generic.List? ListType35 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType26 { get; set; } + public global::System.Collections.Generic.List? ListType36 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType27 { get; set; } + public global::System.Collections.Generic.List? ListType37 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType28 { get; set; } + public global::System.Collections.Generic.List? ListType38 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType29 { get; set; } + public global::System.Collections.Generic.List? ListType39 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType30 { get; set; } + public global::System.Collections.Generic.List? ListType40 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType31 { get; set; } + public global::System.Collections.Generic.List? ListType41 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType32 { get; set; } + public global::System.Collections.Generic.List? ListType42 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType33 { get; set; } + public global::System.Collections.Generic.List? ListType43 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType34 { get; set; } + public global::System.Collections.Generic.List? ListType44 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType35 { get; set; } + public global::System.Collections.Generic.List? ListType45 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType36 { get; set; } + public global::System.Collections.Generic.List? ListType46 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType37 { get; set; } + public global::System.Collections.Generic.List? ListType47 { get; set; } /// /// /// - public global::System.Collections.Generic.List? ListType38 { get; set; } + public global::System.Collections.Generic.List? ListType48 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.AddOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.AddOrganizationMembers.g.cs index 14631d8..144686c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.AddOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.AddOrganizationMembers.g.cs @@ -54,6 +54,31 @@ partial void ProcessAddOrganizationMembersResponseContent( public async global::System.Threading.Tasks.Task AddOrganizationMembersAsync( string organizationId, + global::Ideogram.AddOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AddOrganizationMembersAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Add members to a specific organization + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> AddOrganizationMembersAsResponseAsync( + string organizationId, + global::Ideogram.AddOrganizationMembersRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,11 +114,12 @@ partial void ProcessAddOrganizationMembersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/add_members", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +198,8 @@ partial void ProcessAddOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +210,11 @@ partial void ProcessAddOrganizationMembersResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -199,6 +232,8 @@ partial void ProcessAddOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +243,7 @@ partial void ProcessAddOrganizationMembersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +252,11 @@ partial void ProcessAddOrganizationMembersResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -234,14 +273,15 @@ partial void ProcessAddOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -281,6 +321,8 @@ partial void ProcessAddOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +343,8 @@ partial void ProcessAddOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -324,17 +368,16 @@ partial void ProcessAddOrganizationMembersResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -357,17 +400,16 @@ partial void ProcessAddOrganizationMembersResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -390,17 +432,16 @@ partial void ProcessAddOrganizationMembersResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -423,17 +464,16 @@ partial void ProcessAddOrganizationMembersResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -457,23 +497,25 @@ partial void ProcessAddOrganizationMembersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -487,9 +529,13 @@ partial void ProcessAddOrganizationMembersResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -506,17 +552,15 @@ partial void ProcessAddOrganizationMembersResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKey.g.cs index 4b28653..36186a2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKey.g.cs @@ -26,10 +26,12 @@ public partial class ManageClient { s_CreateApiKeySecurityRequirement0, }; partial void PrepareCreateApiKeyArguments( - global::System.Net.Http.HttpClient httpClient); + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.CreateApiKeyRequest request); partial void PrepareCreateApiKeyRequest( global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage); + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.CreateApiKeyRequest request); partial void ProcessCreateApiKeyResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); @@ -42,17 +44,45 @@ partial void ProcessCreateApiKeyResponseContent( /// /// Creates an API key. /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateApiKeyAsync( + + global::Ideogram.CreateApiKeyRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { + var __response = await CreateApiKeyAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates an API key. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateApiKeyAsResponseAsync( + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + PrepareArguments( client: HttpClient); PrepareCreateApiKeyArguments( - httpClient: HttpClient); + httpClient: HttpClient, + request: request); var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( @@ -76,6 +106,7 @@ partial void ProcessCreateApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/api_keys", baseUri: HttpClient.BaseAddress); @@ -108,6 +139,12 @@ partial void ProcessCreateApiKeyResponseContent( __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; global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -118,7 +155,8 @@ partial void ProcessCreateApiKeyResponseContent( request: __httpRequest); PrepareCreateApiKeyRequest( httpClient: HttpClient, - httpRequestMessage: __httpRequest); + httpRequestMessage: __httpRequest, + request: request); return __httpRequest; } @@ -148,6 +186,8 @@ partial void ProcessCreateApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +198,11 @@ partial void ProcessCreateApiKeyResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +220,8 @@ partial void ProcessCreateApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +231,7 @@ partial void ProcessCreateApiKeyResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +240,11 @@ partial void ProcessCreateApiKeyResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +261,15 @@ partial void ProcessCreateApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +309,8 @@ partial void ProcessCreateApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +331,8 @@ partial void ProcessCreateApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +356,16 @@ partial void ProcessCreateApiKeyResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 402) @@ -333,17 +388,16 @@ partial void ProcessCreateApiKeyResponseContent( __exception_402 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -367,23 +421,25 @@ partial void ProcessCreateApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.PostApiKeyResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostApiKeyResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -397,9 +453,13 @@ partial void ProcessCreateApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.PostApiKeyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostApiKeyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -416,17 +476,15 @@ partial void ProcessCreateApiKeyResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -437,5 +495,29 @@ partial void ProcessCreateApiKeyResponseContent( __httpRequest?.Dispose(); } } + /// + /// Creates an API key. + /// + /// + /// User-supplied label shown alongside the key in the management UI. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateApiKeyAsync( + string? label = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.CreateApiKeyRequest + { + Label = label, + }; + + return await CreateApiKeyAsync( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKeyV2.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKeyV2.g.cs index cc49da7..b2b6600 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKeyV2.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiKeyV2.g.cs @@ -27,11 +27,13 @@ public partial class ManageClient }; partial void PrepareCreateApiKeyV2Arguments( global::System.Net.Http.HttpClient httpClient, - ref string organizationId); + ref string organizationId, + global::Ideogram.CreateApiKeyRequest request); partial void PrepareCreateApiKeyV2Request( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, - string organizationId); + string organizationId, + global::Ideogram.CreateApiKeyRequest request); partial void ProcessCreateApiKeyV2Response( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); @@ -45,19 +47,50 @@ partial void ProcessCreateApiKeyV2ResponseContent( /// Create an API key for a specific organization /// /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task CreateApiKeyV2Async( string organizationId, + + global::Ideogram.CreateApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateApiKeyV2AsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an API key for a specific organization + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateApiKeyV2AsResponseAsync( + string organizationId, + + global::Ideogram.CreateApiKeyRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + PrepareArguments( client: HttpClient); PrepareCreateApiKeyV2Arguments( httpClient: HttpClient, - organizationId: ref organizationId); + organizationId: ref organizationId, + request: request); var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( @@ -81,11 +114,12 @@ partial void ProcessCreateApiKeyV2ResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/api_keys_v2", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -116,6 +150,12 @@ partial void ProcessCreateApiKeyV2ResponseContent( __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; global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -127,7 +167,8 @@ partial void ProcessCreateApiKeyV2ResponseContent( PrepareCreateApiKeyV2Request( httpClient: HttpClient, httpRequestMessage: __httpRequest, - organizationId: organizationId!); + organizationId: organizationId!, + request: request); return __httpRequest; } @@ -157,6 +198,8 @@ partial void ProcessCreateApiKeyV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +210,11 @@ partial void ProcessCreateApiKeyV2ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +232,8 @@ partial void ProcessCreateApiKeyV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +243,7 @@ partial void ProcessCreateApiKeyV2ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +252,11 @@ partial void ProcessCreateApiKeyV2ResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +273,15 @@ partial void ProcessCreateApiKeyV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +321,8 @@ partial void ProcessCreateApiKeyV2ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +343,8 @@ partial void ProcessCreateApiKeyV2ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -309,17 +368,16 @@ partial void ProcessCreateApiKeyV2ResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 402) @@ -342,17 +400,16 @@ partial void ProcessCreateApiKeyV2ResponseContent( __exception_402 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -375,17 +432,16 @@ partial void ProcessCreateApiKeyV2ResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -409,23 +465,25 @@ partial void ProcessCreateApiKeyV2ResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.CreateApiKeyResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.CreateApiKeyResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -439,9 +497,13 @@ partial void ProcessCreateApiKeyV2ResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.CreateApiKeyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.CreateApiKeyResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -458,17 +520,15 @@ partial void ProcessCreateApiKeyV2ResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -479,5 +539,32 @@ partial void ProcessCreateApiKeyV2ResponseContent( __httpRequest?.Dispose(); } } + /// + /// Create an API key for a specific organization + /// + /// + /// + /// User-supplied label shown alongside the key in the management UI. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateApiKeyV2Async( + string organizationId, + string? label = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.CreateApiKeyRequest + { + Label = label, + }; + + return await CreateApiKeyV2Async( + organizationId: organizationId, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiPayment.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiPayment.g.cs new file mode 100644 index 0000000..11d1c33 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.CreateApiPayment.g.cs @@ -0,0 +1,505 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_CreateApiPaymentSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_CreateApiPaymentSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_CreateApiPaymentSecurityRequirement0, + }; + partial void PrepareCreateApiPaymentArguments( + global::System.Net.Http.HttpClient httpClient, + ref string organizationId); + partial void PrepareCreateApiPaymentRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId); + partial void ProcessCreateApiPaymentResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCreateApiPaymentResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a payment setup session for inline card collection.
+ /// Returns a client_secret for the org's payment customer so the inline payment
+ /// modal can save a card without leaving the app.
+ /// Soft-deprecated: the inline Elements flow was removed in the Stripe.js
+ /// eager-bundle incident (2026-05-20). New clients should use the
+ /// stripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which
+ /// returns a hosted Stripe Checkout URL instead. This endpoint will be formally
+ /// deprecated and then removed once no callers reference it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateApiPaymentAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateApiPaymentAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a payment setup session for inline card collection.
+ /// Returns a client_secret for the org's payment customer so the inline payment
+ /// modal can save a card without leaving the app.
+ /// Soft-deprecated: the inline Elements flow was removed in the Stripe.js
+ /// eager-bundle incident (2026-05-20). New clients should use the
+ /// stripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which
+ /// returns a hosted Stripe Checkout URL instead. This endpoint will be formally
+ /// deprecated and then removed once no callers reference it. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateApiPaymentAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareCreateApiPaymentArguments( + httpClient: HttpClient, + organizationId: ref organizationId); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateApiPaymentSecurityRequirements, + operationName: "CreateApiPaymentAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/manage/api/payment", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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); + } + } + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateApiPaymentRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + organizationId: organizationId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateApiPayment", + methodName: "CreateApiPaymentAsync", + pathTemplate: "\"/manage/api/payment\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateApiPayment", + methodName: "CreateApiPaymentAsync", + pathTemplate: "\"/manage/api/payment\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateApiPayment", + methodName: "CreateApiPaymentAsync", + pathTemplate: "\"/manage/api/payment\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCreateApiPaymentResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateApiPayment", + methodName: "CreateApiPaymentAsync", + pathTemplate: "\"/manage/api/payment\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateApiPayment", + methodName: "CreateApiPaymentAsync", + pathTemplate: "\"/manage/api/payment\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + 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; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateApiPaymentResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ManageApiPaymentResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ManageApiPaymentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeactivateOrganizationApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeactivateOrganizationApiKey.g.cs index d1741bc..b1522a4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeactivateOrganizationApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeactivateOrganizationApiKey.g.cs @@ -47,6 +47,24 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( string apiKeyId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeactivateOrganizationApiKeyAsResponseAsync( + apiKeyId: apiKeyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Deactivate an API key for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeactivateOrganizationApiKeyAsResponseAsync( + string apiKeyId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,11 +94,12 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/deactivate_api_key", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("api_key_id", apiKeyId) + .AddRequiredParameter("api_key_id", apiKeyId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -152,6 +171,8 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -162,6 +183,11 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -179,6 +205,8 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -188,8 +216,7 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -198,6 +225,11 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -214,14 +246,15 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -261,6 +294,8 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -281,6 +316,8 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -304,17 +341,16 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -337,17 +373,16 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -370,17 +405,16 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -403,17 +437,16 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -433,20 +466,22 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -454,6 +489,10 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -470,17 +509,15 @@ partial void ProcessDeactivateOrganizationApiKeyResponse( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeleteSingleApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeleteSingleApiKey.g.cs index 06dc884..41454e2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeleteSingleApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.DeleteSingleApiKey.g.cs @@ -47,6 +47,24 @@ partial void ProcessDeleteSingleApiKeyResponse( string apiKeyId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteSingleApiKeyAsResponseAsync( + apiKeyId: apiKeyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete an API key. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteSingleApiKeyAsResponseAsync( + string apiKeyId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +94,7 @@ partial void ProcessDeleteSingleApiKeyResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/manage/api/api_keys/{apiKeyId}", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessDeleteSingleApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessDeleteSingleApiKeyResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessDeleteSingleApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessDeleteSingleApiKeyResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessDeleteSingleApiKeyResponse( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessDeleteSingleApiKeyResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessDeleteSingleApiKeyResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessDeleteSingleApiKeyResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -301,17 +338,16 @@ partial void ProcessDeleteSingleApiKeyResponse( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -334,17 +370,16 @@ partial void ProcessDeleteSingleApiKeyResponse( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -364,20 +399,22 @@ partial void ProcessDeleteSingleApiKeyResponse( { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -385,6 +422,10 @@ partial void ProcessDeleteSingleApiKeyResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -401,17 +442,15 @@ partial void ProcessDeleteSingleApiKeyResponse( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiCreditSummary.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiCreditSummary.g.cs new file mode 100644 index 0000000..2722941 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiCreditSummary.g.cs @@ -0,0 +1,497 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_GetApiCreditSummarySecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_GetApiCreditSummarySecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_GetApiCreditSummarySecurityRequirement0, + }; + partial void PrepareGetApiCreditSummaryArguments( + global::System.Net.Http.HttpClient httpClient, + ref string organizationId); + partial void PrepareGetApiCreditSummaryRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId); + partial void ProcessGetApiCreditSummaryResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetApiCreditSummaryResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Lifetime credit totals for the API user's account.
+ /// Returns the lifetime credit KPIs (consumed, expired, issued) used to
+ /// render the API credit dashboard strip. All values default to $0 when
+ /// Metronome is unavailable so the FE can always render. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetApiCreditSummaryAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiCreditSummaryAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lifetime credit totals for the API user's account.
+ /// Returns the lifetime credit KPIs (consumed, expired, issued) used to
+ /// render the API credit dashboard strip. All values default to $0 when
+ /// Metronome is unavailable so the FE can always render. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiCreditSummaryAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetApiCreditSummaryArguments( + httpClient: HttpClient, + organizationId: ref organizationId); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetApiCreditSummarySecurityRequirements, + operationName: "GetApiCreditSummaryAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/manage/api/credit_summary", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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" || + __authorization.Type == "OpenIdConnect") + { + __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); + } + } + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetApiCreditSummaryRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + organizationId: organizationId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetApiCreditSummary", + methodName: "GetApiCreditSummaryAsync", + pathTemplate: "\"/manage/api/credit_summary\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetApiCreditSummary", + methodName: "GetApiCreditSummaryAsync", + pathTemplate: "\"/manage/api/credit_summary\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetApiCreditSummary", + methodName: "GetApiCreditSummaryAsync", + pathTemplate: "\"/manage/api/credit_summary\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetApiCreditSummaryResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetApiCreditSummary", + methodName: "GetApiCreditSummaryAsync", + pathTemplate: "\"/manage/api/credit_summary\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetApiCreditSummary", + methodName: "GetApiCreditSummaryAsync", + pathTemplate: "\"/manage/api/credit_summary\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + 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; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetApiCreditSummaryResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ManageApiCreditSummaryResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ManageApiCreditSummaryResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeys.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeys.g.cs index 30b41fb..864cf7a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeys.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeys.g.cs @@ -48,6 +48,23 @@ partial void ProcessGetApiKeysResponseContent( public async global::System.Threading.Tasks.Task GetApiKeysAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiKeysAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve current API keys and their respective data. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiKeysAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessGetApiKeysResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/api_keys", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessGetApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessGetApiKeysResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessGetApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessGetApiKeysResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessGetApiKeysResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessGetApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessGetApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessGetApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +336,16 @@ partial void ProcessGetApiKeysResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -333,17 +368,16 @@ partial void ProcessGetApiKeysResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -367,23 +401,25 @@ partial void ProcessGetApiKeysResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetApiKeysResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetApiKeysResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -397,9 +433,13 @@ partial void ProcessGetApiKeysResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetApiKeysResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetApiKeysResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -416,17 +456,15 @@ partial void ProcessGetApiKeysResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeysV2.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeysV2.g.cs index 5635480..7261a1f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeysV2.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiKeysV2.g.cs @@ -52,6 +52,26 @@ partial void ProcessGetApiKeysV2ResponseContent( string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiKeysV2AsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve API keys for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiKeysV2AsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,11 +101,12 @@ partial void ProcessGetApiKeysV2ResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/api_keys", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -157,6 +178,8 @@ partial void ProcessGetApiKeysV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +190,11 @@ partial void ProcessGetApiKeysV2ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +212,8 @@ partial void ProcessGetApiKeysV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +223,7 @@ partial void ProcessGetApiKeysV2ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +232,11 @@ partial void ProcessGetApiKeysV2ResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +253,15 @@ partial void ProcessGetApiKeysV2ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +301,8 @@ partial void ProcessGetApiKeysV2ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +323,8 @@ partial void ProcessGetApiKeysV2ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -309,17 +348,16 @@ partial void ProcessGetApiKeysV2ResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -342,17 +380,16 @@ partial void ProcessGetApiKeysV2ResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -375,17 +412,16 @@ partial void ProcessGetApiKeysV2ResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -409,23 +445,25 @@ partial void ProcessGetApiKeysV2ResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetApiKeysV2Response.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetApiKeysV2Response.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -439,9 +477,13 @@ partial void ProcessGetApiKeysV2ResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetApiKeysV2Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetApiKeysV2Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -458,17 +500,15 @@ partial void ProcessGetApiKeysV2ResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiOrganizationUserSuggestions.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiOrganizationUserSuggestions.g.cs index 23401b9..d237bd8 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiOrganizationUserSuggestions.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiOrganizationUserSuggestions.g.cs @@ -62,6 +62,34 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( int? maxItems = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiOrganizationUserSuggestionsAsResponseAsync( + organizationId: organizationId, + userHandlePrefix: userHandlePrefix, + maxItems: maxItems, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get search results for user handles with suggestions for a particular organization. + /// + /// + /// + /// + /// Default Value: 3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiOrganizationUserSuggestionsAsResponseAsync( + string organizationId, + string? userHandlePrefix = default, + int? maxItems = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,13 +121,14 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/user_suggestions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("organization_id", organizationId) .AddOptionalParameter("user_handle_prefix", userHandlePrefix) - .AddOptionalParameter("maxItems", maxItems?.ToString()) + .AddOptionalParameter("maxItems", maxItems?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -173,6 +202,8 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +214,11 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -200,6 +236,8 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +247,7 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +256,11 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -235,14 +277,15 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -282,6 +325,8 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +347,8 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -325,17 +372,16 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -358,17 +404,16 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -391,17 +436,16 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -425,23 +469,25 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetApiOrganizationUserSuggestionsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetApiOrganizationUserSuggestionsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -455,9 +501,13 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetApiOrganizationUserSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetApiOrganizationUserSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -474,17 +524,15 @@ partial void ProcessGetApiOrganizationUserSuggestionsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiProfiles.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiProfiles.g.cs index 875ac80..cbc9553 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiProfiles.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiProfiles.g.cs @@ -48,6 +48,23 @@ partial void ProcessGetApiProfilesResponseContent( public async global::System.Threading.Tasks.Task GetApiProfilesAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiProfilesAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve the user's current API profiles + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiProfilesAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessGetApiProfilesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/profiles", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessGetApiProfilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessGetApiProfilesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessGetApiProfilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessGetApiProfilesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessGetApiProfilesResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessGetApiProfilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessGetApiProfilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessGetApiProfilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +336,16 @@ partial void ProcessGetApiProfilesResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -333,17 +368,16 @@ partial void ProcessGetApiProfilesResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -367,23 +401,25 @@ partial void ProcessGetApiProfilesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetApiProfilesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetApiProfilesResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -397,9 +433,13 @@ partial void ProcessGetApiProfilesResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetApiProfilesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetApiProfilesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -416,17 +456,15 @@ partial void ProcessGetApiProfilesResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiStripeSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiStripeSubscription.g.cs index 19b3af1..85158c2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiStripeSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiStripeSubscription.g.cs @@ -27,10 +27,12 @@ public partial class ManageClient }; partial void PrepareGetApiStripeSubscriptionArguments( global::System.Net.Http.HttpClient httpClient, + ref string organizationId, ref bool? isBusiness); partial void PrepareGetApiStripeSubscriptionRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId, bool? isBusiness); partial void ProcessGetApiStripeSubscriptionResponse( global::System.Net.Http.HttpClient httpClient, @@ -44,11 +46,36 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( /// /// Retrieve data relevant to connecting to Stripe. /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetApiStripeSubscriptionAsync( + string organizationId, + bool? isBusiness = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiStripeSubscriptionAsResponseAsync( + organizationId: organizationId, + isBusiness: isBusiness, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve data relevant to connecting to Stripe. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiStripeSubscriptionAsResponseAsync( + string organizationId, bool? isBusiness = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -57,6 +84,7 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( client: HttpClient); PrepareGetApiStripeSubscriptionArguments( httpClient: HttpClient, + organizationId: ref organizationId, isBusiness: ref isBusiness); @@ -81,11 +109,13 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/stripe_subscription", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddOptionalParameter("isBusiness", isBusiness?.ToString().ToLowerInvariant()) + .AddRequiredParameter("organization_id", organizationId) + .AddOptionalParameter("isBusiness", isBusiness?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -127,6 +157,7 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( PrepareGetApiStripeSubscriptionRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + organizationId: organizationId!, isBusiness: isBusiness); return __httpRequest; @@ -157,6 +188,8 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +200,11 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +222,8 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +233,7 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +242,11 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +263,15 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +311,8 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +333,8 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -309,17 +358,16 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -342,17 +390,16 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -376,23 +423,25 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ManageApiStripeSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ManageApiStripeSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -406,9 +455,13 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ManageApiStripeSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ManageApiStripeSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -425,17 +478,15 @@ partial void ProcessGetApiStripeSubscriptionResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiSubscription.g.cs index 3f5ebe6..ad6e527 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiSubscription.g.cs @@ -26,10 +26,12 @@ public partial class ManageClient { s_GetApiSubscriptionSecurityRequirement0, }; partial void PrepareGetApiSubscriptionArguments( - global::System.Net.Http.HttpClient httpClient); + global::System.Net.Http.HttpClient httpClient, + ref string organizationId); partial void PrepareGetApiSubscriptionRequest( global::System.Net.Http.HttpClient httpClient, - global::System.Net.Http.HttpRequestMessage httpRequestMessage); + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId); partial void ProcessGetApiSubscriptionResponse( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage); @@ -42,17 +44,40 @@ partial void ProcessGetApiSubscriptionResponseContent( /// /// Retrieve data relevant to creating an API subscription. /// + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task GetApiSubscriptionAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiSubscriptionAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve data relevant to creating an API subscription. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiSubscriptionAsResponseAsync( + string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); PrepareGetApiSubscriptionArguments( - httpClient: HttpClient); + httpClient: HttpClient, + organizationId: ref organizationId); var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( @@ -76,9 +101,13 @@ partial void ProcessGetApiSubscriptionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/subscription", baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, @@ -118,7 +147,8 @@ partial void ProcessGetApiSubscriptionResponseContent( request: __httpRequest); PrepareGetApiSubscriptionRequest( httpClient: HttpClient, - httpRequestMessage: __httpRequest); + httpRequestMessage: __httpRequest, + organizationId: organizationId!); return __httpRequest; } @@ -148,6 +178,8 @@ partial void ProcessGetApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +190,11 @@ partial void ProcessGetApiSubscriptionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +212,8 @@ partial void ProcessGetApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +223,7 @@ partial void ProcessGetApiSubscriptionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +232,11 @@ partial void ProcessGetApiSubscriptionResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +253,15 @@ partial void ProcessGetApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +301,8 @@ partial void ProcessGetApiSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +323,8 @@ partial void ProcessGetApiSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +348,16 @@ partial void ProcessGetApiSubscriptionResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -333,17 +380,16 @@ partial void ProcessGetApiSubscriptionResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -367,23 +413,25 @@ partial void ProcessGetApiSubscriptionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ManageApiSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ManageApiSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -397,9 +445,13 @@ partial void ProcessGetApiSubscriptionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ManageApiSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ManageApiSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -416,17 +468,15 @@ partial void ProcessGetApiSubscriptionResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiTerms.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiTerms.g.cs index 506926d..32fc36d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiTerms.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetApiTerms.g.cs @@ -48,6 +48,23 @@ partial void ProcessGetApiTermsResponseContent( public async global::System.Threading.Tasks.Task GetApiTermsAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetApiTermsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve the latest terms of service for API usage. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetApiTermsAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessGetApiTermsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/terms", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessGetApiTermsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessGetApiTermsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessGetApiTermsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessGetApiTermsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessGetApiTermsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessGetApiTermsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessGetApiTermsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessGetApiTermsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +336,16 @@ partial void ProcessGetApiTermsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -333,17 +368,16 @@ partial void ProcessGetApiTermsResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -367,23 +401,25 @@ partial void ProcessGetApiTermsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetApiTermsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetApiTermsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -397,9 +433,13 @@ partial void ProcessGetApiTermsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetApiTermsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetApiTermsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -416,17 +456,15 @@ partial void ProcessGetApiTermsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationBillingPortal.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationBillingPortal.g.cs new file mode 100644 index 0000000..628bf89 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationBillingPortal.g.cs @@ -0,0 +1,523 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_GetOrganizationBillingPortalSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_GetOrganizationBillingPortalSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_GetOrganizationBillingPortalSecurityRequirement0, + }; + partial void PrepareGetOrganizationBillingPortalArguments( + global::System.Net.Http.HttpClient httpClient, + ref string organizationId); + partial void PrepareGetOrganizationBillingPortalRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId); + partial void ProcessGetOrganizationBillingPortalResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetOrganizationBillingPortalResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve the Stripe billing portal URL for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetOrganizationBillingPortalAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetOrganizationBillingPortalAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve the Stripe billing portal URL for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetOrganizationBillingPortalAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetOrganizationBillingPortalArguments( + httpClient: HttpClient, + organizationId: ref organizationId); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetOrganizationBillingPortalSecurityRequirements, + operationName: "GetOrganizationBillingPortalAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/manage/api/organization/billing_portal", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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" || + __authorization.Type == "OpenIdConnect") + { + __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); + } + } + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetOrganizationBillingPortalRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + organizationId: organizationId!); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetOrganizationBillingPortal", + methodName: "GetOrganizationBillingPortalAsync", + pathTemplate: "\"/manage/api/organization/billing_portal\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetOrganizationBillingPortal", + methodName: "GetOrganizationBillingPortalAsync", + pathTemplate: "\"/manage/api/organization/billing_portal\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetOrganizationBillingPortal", + methodName: "GetOrganizationBillingPortalAsync", + pathTemplate: "\"/manage/api/organization/billing_portal\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetOrganizationBillingPortalResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetOrganizationBillingPortal", + methodName: "GetOrganizationBillingPortalAsync", + pathTemplate: "\"/manage/api/organization/billing_portal\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetOrganizationBillingPortal", + methodName: "GetOrganizationBillingPortalAsync", + pathTemplate: "\"/manage/api/organization/billing_portal\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + 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; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetOrganizationBillingPortalResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.GetOrganizationBillingPortalResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.GetOrganizationBillingPortalResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationMembers.g.cs index c975cd3..54c81c2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetOrganizationMembers.g.cs @@ -52,6 +52,26 @@ partial void ProcessGetOrganizationMembersResponseContent( string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetOrganizationMembersAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve members of a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetOrganizationMembersAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,11 +101,12 @@ partial void ProcessGetOrganizationMembersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/members", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -157,6 +178,8 @@ partial void ProcessGetOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +190,11 @@ partial void ProcessGetOrganizationMembersResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +212,8 @@ partial void ProcessGetOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +223,7 @@ partial void ProcessGetOrganizationMembersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +232,11 @@ partial void ProcessGetOrganizationMembersResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +253,15 @@ partial void ProcessGetOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +301,8 @@ partial void ProcessGetOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +323,8 @@ partial void ProcessGetOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -309,17 +348,16 @@ partial void ProcessGetOrganizationMembersResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -342,17 +380,16 @@ partial void ProcessGetOrganizationMembersResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -375,17 +412,16 @@ partial void ProcessGetOrganizationMembersResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -409,23 +445,25 @@ partial void ProcessGetOrganizationMembersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetOrganizationMembersResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetOrganizationMembersResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -439,9 +477,13 @@ partial void ProcessGetOrganizationMembersResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetOrganizationMembersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetOrganizationMembersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -458,17 +500,15 @@ partial void ProcessGetOrganizationMembersResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUsageInfo.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUsageInfo.g.cs index 9ebd470..59fd685 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUsageInfo.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUsageInfo.g.cs @@ -98,6 +98,64 @@ partial void ProcessGetUsageInfoResponseContent( global::Ideogram.UsageSource? source = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetUsageInfoAsResponseAsync( + organizationId: organizationId, + segmentBy: segmentBy, + startTime: startTime, + endTime: endTime, + modelVersions: modelVersions, + tools: tools, + apiKeyIds: apiKeyIds, + userEmails: userEmails, + source: source, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve usage information segmented by time period with tool-specific breakdowns + /// + /// + /// + /// Time segment granularity for usage breakdown
+ /// Example: DAY + /// + /// + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Default Value: [] + /// + /// + /// Filter usage by source - API for programmatic API usage, APP for web application usage
+ /// Default Value: API + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetUsageInfoAsResponseAsync( + string organizationId, + global::Ideogram.SegmentBy segmentBy, + global::System.DateTime startTime, + global::System.DateTime? endTime = default, + global::System.Collections.Generic.IList? modelVersions = default, + global::System.Collections.Generic.IList? tools = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? userEmails = default, + global::Ideogram.UsageSource? source = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -135,9 +193,10 @@ partial void ProcessGetUsageInfoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/usage", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("organization_id", organizationId) .AddRequiredParameter("segment_by", segmentBy.ToValueString()) @@ -147,7 +206,7 @@ partial void ProcessGetUsageInfoResponseContent( .AddOptionalParameter("tools", tools, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("api_key_ids", apiKeyIds, delimiter: ",", explode: true) .AddOptionalParameter("user_emails", userEmails, delimiter: ",", explode: true) - .AddOptionalParameter("source", source?.ToValueString()) + .AddOptionalParameter("source", source?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -227,6 +286,8 @@ partial void ProcessGetUsageInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -237,6 +298,11 @@ partial void ProcessGetUsageInfoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -254,6 +320,8 @@ partial void ProcessGetUsageInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -263,8 +331,7 @@ partial void ProcessGetUsageInfoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +340,11 @@ partial void ProcessGetUsageInfoResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -289,14 +361,15 @@ partial void ProcessGetUsageInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -336,6 +409,8 @@ partial void ProcessGetUsageInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -356,6 +431,8 @@ partial void ProcessGetUsageInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -379,17 +456,16 @@ partial void ProcessGetUsageInfoResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -412,17 +488,16 @@ partial void ProcessGetUsageInfoResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -446,23 +521,25 @@ partial void ProcessGetUsageInfoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetUsageInfoResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetUsageInfoResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -476,9 +553,13 @@ partial void ProcessGetUsageInfoResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetUsageInfoResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetUsageInfoResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -495,17 +576,15 @@ partial void ProcessGetUsageInfoResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserCredits.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserCredits.g.cs index 5798374..c7929a3 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserCredits.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserCredits.g.cs @@ -60,6 +60,32 @@ partial void ProcessGetUserCreditsResponseContent( global::System.DateTime? endTime = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetUserCreditsAsResponseAsync( + organizationId: organizationId, + startTime: startTime, + endTime: endTime, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve user credit information and spending metrics + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetUserCreditsAsResponseAsync( + string organizationId, + global::System.DateTime startTime, + global::System.DateTime? endTime = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,13 +117,14 @@ partial void ProcessGetUserCreditsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/credits", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("organization_id", organizationId) .AddRequiredParameter("start_time", startTime.ToString("yyyy-MM-ddTHH:mm:ssZ")) - .AddOptionalParameter("end_time", endTime?.ToString("yyyy-MM-ddTHH:mm:ssZ")) + .AddOptionalParameter("end_time", endTime?.ToString("yyyy-MM-ddTHH:mm:ssZ")) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -171,6 +198,8 @@ partial void ProcessGetUserCreditsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +210,11 @@ partial void ProcessGetUserCreditsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -198,6 +232,8 @@ partial void ProcessGetUserCreditsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -207,8 +243,7 @@ partial void ProcessGetUserCreditsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -217,6 +252,11 @@ partial void ProcessGetUserCreditsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -233,14 +273,15 @@ partial void ProcessGetUserCreditsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -280,6 +321,8 @@ partial void ProcessGetUserCreditsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +343,8 @@ partial void ProcessGetUserCreditsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -323,17 +368,16 @@ partial void ProcessGetUserCreditsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -356,17 +400,16 @@ partial void ProcessGetUserCreditsResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -390,23 +433,25 @@ partial void ProcessGetUserCreditsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetUserCreditsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetUserCreditsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -420,9 +465,13 @@ partial void ProcessGetUserCreditsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetUserCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetUserCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -439,17 +488,15 @@ partial void ProcessGetUserCreditsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserSpendCommitInfo.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserSpendCommitInfo.g.cs index 2424e81..f1a640a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserSpendCommitInfo.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.GetUserSpendCommitInfo.g.cs @@ -56,6 +56,29 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( bool? postpaidOnly = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetUserSpendCommitInfoAsResponseAsync( + organizationId: organizationId, + postpaidOnly: postpaidOnly, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve user spend commit information + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetUserSpendCommitInfoAsResponseAsync( + string organizationId, + bool? postpaidOnly = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,12 +109,13 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/spend_commit", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("organization_id", organizationId) - .AddOptionalParameter("postpaid_only", postpaidOnly?.ToString().ToLowerInvariant()) + .AddOptionalParameter("postpaid_only", postpaidOnly?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -164,6 +188,8 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -316,17 +358,16 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -349,17 +390,16 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -383,23 +423,25 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.SpendCommitInfoResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.SpendCommitInfoResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -413,9 +455,13 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.SpendCommitInfoResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.SpendCommitInfoResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -432,17 +478,15 @@ partial void ProcessGetUserSpendCommitInfoResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.ListOrganizationInvoices.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.ListOrganizationInvoices.g.cs index ebc88e2..174e4e0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.ListOrganizationInvoices.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.ListOrganizationInvoices.g.cs @@ -52,6 +52,26 @@ partial void ProcessListOrganizationInvoicesResponseContent( string organizationId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListOrganizationInvoicesAsResponseAsync( + organizationId: organizationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve invoices for a specific organization + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListOrganizationInvoicesAsResponseAsync( + string organizationId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,11 +101,12 @@ partial void ProcessListOrganizationInvoicesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/list_invoices", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -157,6 +178,8 @@ partial void ProcessListOrganizationInvoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +190,11 @@ partial void ProcessListOrganizationInvoicesResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -184,6 +212,8 @@ partial void ProcessListOrganizationInvoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +223,7 @@ partial void ProcessListOrganizationInvoicesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +232,11 @@ partial void ProcessListOrganizationInvoicesResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -219,14 +253,15 @@ partial void ProcessListOrganizationInvoicesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -266,6 +301,8 @@ partial void ProcessListOrganizationInvoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +323,8 @@ partial void ProcessListOrganizationInvoicesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -309,17 +348,16 @@ partial void ProcessListOrganizationInvoicesResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -342,17 +380,16 @@ partial void ProcessListOrganizationInvoicesResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -375,17 +412,16 @@ partial void ProcessListOrganizationInvoicesResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -409,23 +445,25 @@ partial void ProcessListOrganizationInvoicesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ListOrganizationInvoicesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ListOrganizationInvoicesResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -439,9 +477,13 @@ partial void ProcessListOrganizationInvoicesResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ListOrganizationInvoicesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ListOrganizationInvoicesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -458,17 +500,15 @@ partial void ProcessListOrganizationInvoicesResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs index 13a46bd..9c3776a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostAddCreditsForApi.g.cs @@ -27,10 +27,12 @@ public partial class ManageClient }; partial void PreparePostAddCreditsForApiArguments( global::System.Net.Http.HttpClient httpClient, + ref string organizationId, global::Ideogram.PostAddCreditsRequest request); partial void PreparePostAddCreditsForApiRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId, global::Ideogram.PostAddCreditsRequest request); partial void ProcessPostAddCreditsForApiResponse( global::System.Net.Http.HttpClient httpClient, @@ -44,11 +46,38 @@ partial void ProcessPostAddCreditsForApiResponseContent( /// /// Add credits to an API user's account. /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + string organizationId, + + global::Ideogram.PostAddCreditsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostAddCreditsForApiAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Add credits to an API user's account. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostAddCreditsForApiAsResponseAsync( + string organizationId, global::Ideogram.PostAddCreditsRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, @@ -60,6 +89,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( client: HttpClient); PreparePostAddCreditsForApiArguments( httpClient: HttpClient, + organizationId: ref organizationId, request: request); @@ -84,9 +114,13 @@ partial void ProcessPostAddCreditsForApiResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/add_credits", baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, @@ -133,6 +167,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( PreparePostAddCreditsForApiRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + organizationId: organizationId!, request: request); return __httpRequest; @@ -163,6 +198,8 @@ partial void ProcessPostAddCreditsForApiResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +210,11 @@ partial void ProcessPostAddCreditsForApiResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +232,8 @@ partial void ProcessPostAddCreditsForApiResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +243,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +252,11 @@ partial void ProcessPostAddCreditsForApiResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +273,15 @@ partial void ProcessPostAddCreditsForApiResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +321,8 @@ partial void ProcessPostAddCreditsForApiResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +343,8 @@ partial void ProcessPostAddCreditsForApiResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -319,18 +372,17 @@ partial void ProcessPostAddCreditsForApiResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -353,17 +405,16 @@ partial void ProcessPostAddCreditsForApiResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -386,17 +437,16 @@ partial void ProcessPostAddCreditsForApiResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -420,23 +470,25 @@ partial void ProcessPostAddCreditsForApiResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.PostAddCreditsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostAddCreditsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -450,9 +502,13 @@ partial void ProcessPostAddCreditsForApiResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.PostAddCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostAddCreditsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -469,17 +525,15 @@ partial void ProcessPostAddCreditsForApiResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -493,6 +547,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( /// /// Add credits to an API user's account. /// + /// /// /// Represents a price.
/// Example: {"amount":1050,"currency_code":"USD"} @@ -501,6 +556,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostAddCreditsForApiAsync( + string organizationId, global::Ideogram.Price amount, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -511,6 +567,7 @@ partial void ProcessPostAddCreditsForApiResponseContent( }; return await PostAddCreditsForApiAsync( + organizationId: organizationId, request: __request, requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiSubscription.g.cs index 73f9660..cc94735 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiSubscription.g.cs @@ -27,10 +27,12 @@ public partial class ManageClient }; partial void PreparePostApiSubscriptionArguments( global::System.Net.Http.HttpClient httpClient, + ref string organizationId, global::Ideogram.PostApiSubscriptionRequest request); partial void PreparePostApiSubscriptionRequest( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId, global::Ideogram.PostApiSubscriptionRequest request); partial void ProcessPostApiSubscriptionResponse( global::System.Net.Http.HttpClient httpClient, @@ -44,11 +46,38 @@ partial void ProcessPostApiSubscriptionResponseContent( /// /// Update API subscription settings /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostApiSubscriptionAsync( + string organizationId, + + global::Ideogram.PostApiSubscriptionRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostApiSubscriptionAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update API subscription settings + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostApiSubscriptionAsResponseAsync( + string organizationId, global::Ideogram.PostApiSubscriptionRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, @@ -60,6 +89,7 @@ partial void ProcessPostApiSubscriptionResponseContent( client: HttpClient); PreparePostApiSubscriptionArguments( httpClient: HttpClient, + organizationId: ref organizationId, request: request); @@ -84,9 +114,13 @@ partial void ProcessPostApiSubscriptionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/subscription", baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("organization_id", organizationId) + ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( path: __path, @@ -133,6 +167,7 @@ partial void ProcessPostApiSubscriptionResponseContent( PreparePostApiSubscriptionRequest( httpClient: HttpClient, httpRequestMessage: __httpRequest, + organizationId: organizationId!, request: request); return __httpRequest; @@ -163,6 +198,8 @@ partial void ProcessPostApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +210,11 @@ partial void ProcessPostApiSubscriptionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -190,6 +232,8 @@ partial void ProcessPostApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -199,8 +243,7 @@ partial void ProcessPostApiSubscriptionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -209,6 +252,11 @@ partial void ProcessPostApiSubscriptionResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -225,14 +273,15 @@ partial void ProcessPostApiSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -272,6 +321,8 @@ partial void ProcessPostApiSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +343,8 @@ partial void ProcessPostApiSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -319,18 +372,17 @@ partial void ProcessPostApiSubscriptionResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -353,17 +405,16 @@ partial void ProcessPostApiSubscriptionResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -386,17 +437,16 @@ partial void ProcessPostApiSubscriptionResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -420,23 +470,25 @@ partial void ProcessPostApiSubscriptionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.PostApiSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostApiSubscriptionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -450,9 +502,13 @@ partial void ProcessPostApiSubscriptionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.PostApiSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostApiSubscriptionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -469,17 +525,15 @@ partial void ProcessPostApiSubscriptionResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -493,6 +547,7 @@ partial void ProcessPostApiSubscriptionResponseContent( /// /// Update API subscription settings /// + /// /// /// The current recharge settings for the API subscription.
/// Example: {"minimum_balance_threshold":{"amount":1050,"currency_code":"USD"},"top_up_balance":{"amount":1050,"currency_code":"USD"}} @@ -504,6 +559,7 @@ partial void ProcessPostApiSubscriptionResponseContent( /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostApiSubscriptionAsync( + string organizationId, global::Ideogram.RechargeSettings? rechargeSettings = default, bool? isActive = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, @@ -516,6 +572,7 @@ partial void ProcessPostApiSubscriptionResponseContent( }; return await PostApiSubscriptionAsync( + organizationId: organizationId, request: __request, requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiTerms.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiTerms.g.cs index f0bad0c..962d93d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiTerms.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PostApiTerms.g.cs @@ -45,6 +45,26 @@ partial void ProcessPostApiTermsResponse( /// public async global::System.Threading.Tasks.Task PostApiTermsAsync( + global::Ideogram.PostApiTermsRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await PostApiTermsAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Accept terms + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostApiTermsAsResponseAsync( + global::Ideogram.PostApiTermsRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -79,6 +99,7 @@ partial void ProcessPostApiTermsResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/terms", baseUri: HttpClient.BaseAddress); @@ -158,6 +179,8 @@ partial void ProcessPostApiTermsResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -168,6 +191,11 @@ partial void ProcessPostApiTermsResponse( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -185,6 +213,8 @@ partial void ProcessPostApiTermsResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -194,8 +224,7 @@ partial void ProcessPostApiTermsResponse( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -204,6 +233,11 @@ partial void ProcessPostApiTermsResponse( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -220,14 +254,15 @@ partial void ProcessPostApiTermsResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -267,6 +302,8 @@ partial void ProcessPostApiTermsResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -287,6 +324,8 @@ partial void ProcessPostApiTermsResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -310,17 +349,16 @@ partial void ProcessPostApiTermsResponse( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -343,17 +381,16 @@ partial void ProcessPostApiTermsResponse( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -376,17 +413,16 @@ partial void ProcessPostApiTermsResponse( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -406,20 +442,22 @@ partial void ProcessPostApiTermsResponse( { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -427,6 +465,10 @@ partial void ProcessPostApiTermsResponse( try { __response.EnsureSuccessStatusCode(); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -443,17 +485,15 @@ partial void ProcessPostApiTermsResponse( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PromoteOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PromoteOrganizationMembers.g.cs index e4f3bdb..97b63c8 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.PromoteOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.PromoteOrganizationMembers.g.cs @@ -54,6 +54,31 @@ partial void ProcessPromoteOrganizationMembersResponseContent( public async global::System.Threading.Tasks.Task PromoteOrganizationMembersAsync( string organizationId, + global::Ideogram.PromoteOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PromoteOrganizationMembersAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Promote members to OWNER role in a specific organization + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PromoteOrganizationMembersAsResponseAsync( + string organizationId, + global::Ideogram.PromoteOrganizationMembersRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,11 +114,12 @@ partial void ProcessPromoteOrganizationMembersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/promote_members", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +198,8 @@ partial void ProcessPromoteOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +210,11 @@ partial void ProcessPromoteOrganizationMembersResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -199,6 +232,8 @@ partial void ProcessPromoteOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +243,7 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +252,11 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -234,14 +273,15 @@ partial void ProcessPromoteOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -281,6 +321,8 @@ partial void ProcessPromoteOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +343,8 @@ partial void ProcessPromoteOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -324,17 +368,16 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -357,17 +400,16 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -390,17 +432,16 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -423,17 +464,16 @@ partial void ProcessPromoteOrganizationMembersResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -457,23 +497,25 @@ partial void ProcessPromoteOrganizationMembersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -487,9 +529,13 @@ partial void ProcessPromoteOrganizationMembersResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -506,17 +552,15 @@ partial void ProcessPromoteOrganizationMembersResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.ReactivateSubscription.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.ReactivateSubscription.g.cs index 5865451..1df8ebe 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.ReactivateSubscription.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.ReactivateSubscription.g.cs @@ -48,6 +48,23 @@ partial void ProcessReactivateSubscriptionResponseContent( public async global::System.Threading.Tasks.Task ReactivateSubscriptionAsync( global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ReactivateSubscriptionAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Reactivates a subscription by attempting to re-enable Metronome billing. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ReactivateSubscriptionAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessReactivateSubscriptionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/reactivate", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessReactivateSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessReactivateSubscriptionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessReactivateSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessReactivateSubscriptionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessReactivateSubscriptionResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessReactivateSubscriptionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessReactivateSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessReactivateSubscriptionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -300,17 +336,16 @@ partial void ProcessReactivateSubscriptionResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 402) @@ -333,17 +368,16 @@ partial void ProcessReactivateSubscriptionResponseContent( __exception_402 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -366,17 +400,16 @@ partial void ProcessReactivateSubscriptionResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -400,23 +433,25 @@ partial void ProcessReactivateSubscriptionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.PostApiReactivateResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.PostApiReactivateResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -430,9 +465,13 @@ partial void ProcessReactivateSubscriptionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.PostApiReactivateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.PostApiReactivateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -449,17 +488,15 @@ partial void ProcessReactivateSubscriptionResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.RemoveOrganizationMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.RemoveOrganizationMembers.g.cs index bd5a28a..b25ea84 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.RemoveOrganizationMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.RemoveOrganizationMembers.g.cs @@ -54,6 +54,31 @@ partial void ProcessRemoveOrganizationMembersResponseContent( public async global::System.Threading.Tasks.Task RemoveOrganizationMembersAsync( string organizationId, + global::Ideogram.RemoveOrganizationMembersRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RemoveOrganizationMembersAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Remove members from a specific organization + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> RemoveOrganizationMembersAsResponseAsync( + string organizationId, + global::Ideogram.RemoveOrganizationMembersRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,11 +114,12 @@ partial void ProcessRemoveOrganizationMembersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/manage/api/organization/remove_members", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("organization_id", organizationId) + .AddRequiredParameter("organization_id", organizationId) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +198,8 @@ partial void ProcessRemoveOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +210,11 @@ partial void ProcessRemoveOrganizationMembersResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -199,6 +232,8 @@ partial void ProcessRemoveOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +243,7 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +252,11 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -234,14 +273,15 @@ partial void ProcessRemoveOrganizationMembersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -281,6 +321,8 @@ partial void ProcessRemoveOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +343,8 @@ partial void ProcessRemoveOrganizationMembersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -324,17 +368,16 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -357,17 +400,16 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 403) @@ -390,17 +432,16 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __exception_403 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_403, - statusCode: __response.StatusCode) - { - ResponseBody = __content_403, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -423,17 +464,16 @@ partial void ProcessRemoveOrganizationMembersResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -457,23 +497,25 @@ partial void ProcessRemoveOrganizationMembersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.OrganizationMemberOperationResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -487,9 +529,13 @@ partial void ProcessRemoveOrganizationMembersResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.OrganizationMemberOperationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -506,17 +552,15 @@ partial void ProcessRemoveOrganizationMembersResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateOrganizationApiProperties.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateOrganizationApiProperties.g.cs new file mode 100644 index 0000000..6c46321 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateOrganizationApiProperties.g.cs @@ -0,0 +1,576 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_UpdateOrganizationApiPropertiesSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_UpdateOrganizationApiPropertiesSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_UpdateOrganizationApiPropertiesSecurityRequirement0, + }; + partial void PrepareUpdateOrganizationApiPropertiesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string organizationId, + global::Ideogram.UpdateOrganizationApiPropertiesRequest request); + partial void PrepareUpdateOrganizationApiPropertiesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string organizationId, + global::Ideogram.UpdateOrganizationApiPropertiesRequest request); + partial void ProcessUpdateOrganizationApiPropertiesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessUpdateOrganizationApiPropertiesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateOrganizationApiPropertiesAsync( + string organizationId, + + global::Ideogram.UpdateOrganizationApiPropertiesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateOrganizationApiPropertiesAsResponseAsync( + organizationId: organizationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdateOrganizationApiPropertiesAsResponseAsync( + string organizationId, + + global::Ideogram.UpdateOrganizationApiPropertiesRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareUpdateOrganizationApiPropertiesArguments( + httpClient: HttpClient, + organizationId: ref organizationId, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UpdateOrganizationApiPropertiesSecurityRequirements, + operationName: "UpdateOrganizationApiPropertiesAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: $"/manage/api/organization/{organizationId}/api_properties", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + 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" || + __authorization.Type == "OpenIdConnect") + { + __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; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUpdateOrganizationApiPropertiesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + organizationId: organizationId!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateOrganizationApiProperties", + methodName: "UpdateOrganizationApiPropertiesAsync", + pathTemplate: "$\"/manage/api/organization/{organizationId}/api_properties\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateOrganizationApiProperties", + methodName: "UpdateOrganizationApiPropertiesAsync", + pathTemplate: "$\"/manage/api/organization/{organizationId}/api_properties\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateOrganizationApiProperties", + methodName: "UpdateOrganizationApiPropertiesAsync", + pathTemplate: "$\"/manage/api/organization/{organizationId}/api_properties\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUpdateOrganizationApiPropertiesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateOrganizationApiProperties", + methodName: "UpdateOrganizationApiPropertiesAsync", + pathTemplate: "$\"/manage/api/organization/{organizationId}/api_properties\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateOrganizationApiProperties", + methodName: "UpdateOrganizationApiPropertiesAsync", + pathTemplate: "$\"/manage/api/organization/{organizationId}/api_properties\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + 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; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUpdateOrganizationApiPropertiesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.UpdateOrganizationApiPropertiesResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.UpdateOrganizationApiPropertiesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Update a single field on an organization's API properties.
+ /// Lets an organization owner toggle API-only settings such as
+ /// copyright_detection_enabled. Updates only the fields explicitly present
+ /// in the request body; absent fields are left unchanged. + ///
+ /// + /// + /// Toggle post-generation Hive likeness + logo detection for this organization. See ApiProfile.copyright_detection_enabled for behavior. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateOrganizationApiPropertiesAsync( + string organizationId, + bool? copyrightDetectionEnabled = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.UpdateOrganizationApiPropertiesRequest + { + CopyrightDetectionEnabled = copyrightDetectionEnabled, + }; + + return await UpdateOrganizationApiPropertiesAsync( + organizationId: organizationId, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateSingleApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateSingleApiKey.g.cs new file mode 100644 index 0000000..a2bcd33 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.UpdateSingleApiKey.g.cs @@ -0,0 +1,568 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class ManageClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_UpdateSingleApiKeySecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_UpdateSingleApiKeySecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_UpdateSingleApiKeySecurityRequirement0, + }; + partial void PrepareUpdateSingleApiKeyArguments( + global::System.Net.Http.HttpClient httpClient, + ref string apiKeyId, + global::Ideogram.PatchApiKeyRequest request); + partial void PrepareUpdateSingleApiKeyRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string apiKeyId, + global::Ideogram.PatchApiKeyRequest request); + partial void ProcessUpdateSingleApiKeyResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessUpdateSingleApiKeyResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateSingleApiKeyAsync( + string apiKeyId, + + global::Ideogram.PatchApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateSingleApiKeyAsResponseAsync( + apiKeyId: apiKeyId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdateSingleApiKeyAsResponseAsync( + string apiKeyId, + + global::Ideogram.PatchApiKeyRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareUpdateSingleApiKeyArguments( + httpClient: HttpClient, + apiKeyId: ref apiKeyId, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UpdateSingleApiKeySecurityRequirements, + operationName: "UpdateSingleApiKeyAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: $"/manage/api/api_keys/{apiKeyId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + 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" || + __authorization.Type == "OpenIdConnect") + { + __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; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUpdateSingleApiKeyRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + apiKeyId: apiKeyId!, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSingleApiKey", + methodName: "UpdateSingleApiKeyAsync", + pathTemplate: "$\"/manage/api/api_keys/{apiKeyId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSingleApiKey", + methodName: "UpdateSingleApiKeyAsync", + pathTemplate: "$\"/manage/api/api_keys/{apiKeyId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSingleApiKey", + methodName: "UpdateSingleApiKeyAsync", + pathTemplate: "$\"/manage/api/api_keys/{apiKeyId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUpdateSingleApiKeyResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSingleApiKey", + methodName: "UpdateSingleApiKeyAsync", + pathTemplate: "$\"/manage/api/api_keys/{apiKeyId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSingleApiKey", + methodName: "UpdateSingleApiKeyAsync", + pathTemplate: "$\"/manage/api/api_keys/{apiKeyId}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUpdateSingleApiKeyResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.ApiProfileApiKey.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.ApiProfileApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Update an API key's user-supplied label. + /// + /// + /// + /// New label for the API key. Pass null (or omit) to clear the existing label.
+ /// Example: Live production environment + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateSingleApiKeyAsync( + string apiKeyId, + string? label = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.PatchApiKeyRequest + { + Label = label, + }; + + return await UpdateSingleApiKeyAsync( + apiKeyId: apiKeyId, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ManageClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.ManageClient.g.cs index b9db555..78027e7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ManageClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ManageClient.g.cs @@ -62,6 +62,27 @@ public ManageClient( { } + /// + /// Creates a new instance of the ManageClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ManageClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the ManageClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public ManageClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ManageClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.AddOrganizationMembersRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.AddOrganizationMembersRequest.g.cs index 6b14b59..d15a181 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.AddOrganizationMembersRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.AddOrganizationMembersRequest.g.cs @@ -44,5 +44,6 @@ public AddOrganizationMembersRequest( public AddOrganizationMembersRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ApiOrganizationUserSuggestion.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ApiOrganizationUserSuggestion.g.cs index 228782e..4a6ed42 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ApiOrganizationUserSuggestion.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ApiOrganizationUserSuggestion.g.cs @@ -88,5 +88,6 @@ public ApiOrganizationUserSuggestion( public ApiOrganizationUserSuggestion() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.cs index 58878a4..5aa3886 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfile.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"is_metronome_2_user":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10} + /// Example: {"is_metronome_2_user":true,"copyright_detection_enabled":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10} /// public sealed partial class ApiProfile { @@ -78,6 +78,12 @@ public sealed partial class ApiProfile [global::System.Text.Json.Serialization.JsonRequired] public required int MaxNumInflightRequestsPermitted { get; set; } + /// + /// Whether post-generation copyright detection (Hive likeness + logo) is enabled for this organization's API generations. When true, every successful generation is run through Hive IP scoring after the asset is saved; images that cross the likeness or logo thresholds come back with `is_image_safe = false`. Only populated for ENTERPRISE profiles. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("copyright_detection_enabled")] + public bool? CopyrightDetectionEnabled { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -118,6 +124,9 @@ public sealed partial class ApiProfile /// URL to the profile avatar
/// Example: https://example.com/avatar.jpg /// + /// + /// Whether post-generation copyright detection (Hive likeness + logo) is enabled for this organization's API generations. When true, every successful generation is run through Hive IP scoring after the asset is saved; images that cross the likeness or logo thresholds come back with `is_image_safe = false`. Only populated for ENTERPRISE profiles. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -129,7 +138,8 @@ public ApiProfile( global::System.Collections.Generic.IList apiKeys, bool isMetronome2User, int maxNumInflightRequestsPermitted, - string? avatarUrl) + string? avatarUrl, + bool? copyrightDetectionEnabled) { this.Type = type; this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); @@ -139,6 +149,7 @@ public ApiProfile( this.ApiKeys = apiKeys ?? throw new global::System.ArgumentNullException(nameof(apiKeys)); this.IsMetronome2User = isMetronome2User; this.MaxNumInflightRequestsPermitted = maxNumInflightRequestsPermitted; + this.CopyrightDetectionEnabled = copyrightDetectionEnabled; } /// @@ -147,5 +158,6 @@ public ApiProfile( public ApiProfile() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileApiKey.g.cs index 5f5515b..86eafc0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileApiKey.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null} + /// Example: {"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null} /// public sealed partial class ApiProfileApiKey { @@ -41,6 +41,14 @@ public sealed partial class ApiProfileApiKey [global::System.Text.Json.Serialization.JsonRequired] public required global::Ideogram.ApiKeyStatus Status { get; set; } + /// + /// An optional user-supplied label for managing the API key
+ /// Example: Live production environment + ///
+ /// Live production environment + [global::System.Text.Json.Serialization.JsonPropertyName("label")] + public string? Label { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -64,6 +72,10 @@ public sealed partial class ApiProfileApiKey /// /// Status of the API key /// + /// + /// An optional user-supplied label for managing the API key
+ /// Example: Live production environment + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -71,12 +83,14 @@ public ApiProfileApiKey( string apiKeyId, string redactedApiKey, global::System.DateTime creationTime, - global::Ideogram.ApiKeyStatus status) + global::Ideogram.ApiKeyStatus status, + string? label) { this.ApiKeyId = apiKeyId ?? throw new global::System.ArgumentNullException(nameof(apiKeyId)); this.RedactedApiKey = redactedApiKey ?? throw new global::System.ArgumentNullException(nameof(redactedApiKey)); this.CreationTime = creationTime; this.Status = status; + this.Label = label; } /// @@ -85,5 +99,6 @@ public ApiProfileApiKey( public ApiProfileApiKey() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileType.g.cs index 89ed00b..9d92d98 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileType.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ApiProfileType.g.cs @@ -17,6 +17,10 @@ public enum ApiProfileType /// /// Individual, + /// + /// + /// + TeamApi, } /// @@ -33,6 +37,7 @@ public static string ToValueString(this ApiProfileType value) { ApiProfileType.Enterprise => "ENTERPRISE", ApiProfileType.Individual => "INDIVIDUAL", + ApiProfileType.TeamApi => "TEAM_API", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -45,6 +50,7 @@ public static string ToValueString(this ApiProfileType value) { "ENTERPRISE" => ApiProfileType.Enterprise, "INDIVIDUAL" => ApiProfileType.Individual, + "TEAM_API" => ApiProfileType.TeamApi, _ => null, }; } diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ApiTerms.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ApiTerms.g.cs index 70c489d..6deb549 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ApiTerms.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ApiTerms.g.cs @@ -54,5 +54,6 @@ public ApiTerms( public ApiTerms() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.AspectRatioV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.AspectRatioV4.g.cs new file mode 100644 index 0000000..b0ea758 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.AspectRatioV4.g.cs @@ -0,0 +1,151 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The aspect ratio for an Ideogram 4.0 magic prompt. `AUTO` lets the
+ /// model select the most suitable ratio from the prompt; any other value
+ /// pins the ratio. The non-AUTO values are the buckets the 4.0 model
+ /// supports.
+ /// Default Value: AUTO + ///
+ public enum AspectRatioV4 + { + /// + /// + /// + x10x16, + /// + /// + /// + x16x10, + /// + /// + /// + x16x9, + /// + /// + /// + x1x1, + /// + /// + /// + x1x2, + /// + /// + /// + x1x3, + /// + /// + /// + x1x4, + /// + /// + /// + x2x1, + /// + /// + /// + x2x3, + /// + /// + /// + x3x1, + /// + /// + /// + x3x2, + /// + /// + /// + x3x4, + /// + /// + /// + x4x1, + /// + /// + /// + x4x3, + /// + /// + /// + x4x5, + /// + /// + /// + x5x4, + /// + /// + /// + x9x16, + /// + /// + /// + Auto, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class AspectRatioV4Extensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this AspectRatioV4 value) + { + return value switch + { + AspectRatioV4.x10x16 => "10x16", + AspectRatioV4.x16x10 => "16x10", + AspectRatioV4.x16x9 => "16x9", + AspectRatioV4.x1x1 => "1x1", + AspectRatioV4.x1x2 => "1x2", + AspectRatioV4.x1x3 => "1x3", + AspectRatioV4.x1x4 => "1x4", + AspectRatioV4.x2x1 => "2x1", + AspectRatioV4.x2x3 => "2x3", + AspectRatioV4.x3x1 => "3x1", + AspectRatioV4.x3x2 => "3x2", + AspectRatioV4.x3x4 => "3x4", + AspectRatioV4.x4x1 => "4x1", + AspectRatioV4.x4x3 => "4x3", + AspectRatioV4.x4x5 => "4x5", + AspectRatioV4.x5x4 => "5x4", + AspectRatioV4.x9x16 => "9x16", + AspectRatioV4.Auto => "AUTO", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static AspectRatioV4? ToEnum(string value) + { + return value switch + { + "10x16" => AspectRatioV4.x10x16, + "16x10" => AspectRatioV4.x16x10, + "16x9" => AspectRatioV4.x16x9, + "1x1" => AspectRatioV4.x1x1, + "1x2" => AspectRatioV4.x1x2, + "1x3" => AspectRatioV4.x1x3, + "1x4" => AspectRatioV4.x1x4, + "2x1" => AspectRatioV4.x2x1, + "2x3" => AspectRatioV4.x2x3, + "3x1" => AspectRatioV4.x3x1, + "3x2" => AspectRatioV4.x3x2, + "3x4" => AspectRatioV4.x3x4, + "4x1" => AspectRatioV4.x4x1, + "4x3" => AspectRatioV4.x4x3, + "4x5" => AspectRatioV4.x4x5, + "5x4" => AspectRatioV4.x5x4, + "9x16" => AspectRatioV4.x9x16, + "AUTO" => AspectRatioV4.Auto, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.AssetIdentifier.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.AssetIdentifier.g.cs index 23bad4d..fcadde1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.AssetIdentifier.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.AssetIdentifier.g.cs @@ -52,5 +52,6 @@ public AssetIdentifier( public AssetIdentifier() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.AsyncImageGenerationResponseV4.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.AsyncImageGenerationResponseV4.Json.g.cs new file mode 100644 index 0000000..8190f6e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.AsyncImageGenerationResponseV4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class AsyncImageGenerationResponseV4 + { + /// + /// 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.AsyncImageGenerationResponseV4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.AsyncImageGenerationResponseV4), + jsonSerializerContext) as global::Ideogram.AsyncImageGenerationResponseV4; + } + + /// + /// 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.AsyncImageGenerationResponseV4? 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.AsyncImageGenerationResponseV4), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.AsyncImageGenerationResponseV4; + } + + /// + /// 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.AsyncImageGenerationResponseV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.AsyncImageGenerationResponseV4.g.cs new file mode 100644 index 0000000..45f7232 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.AsyncImageGenerationResponseV4.g.cs @@ -0,0 +1,55 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Acknowledgement returned by the async (webhook) generation endpoints. The
+ /// request is accepted for asynchronous processing and the generated images
+ /// are POSTed to the supplied `webhook_url` once ready; this body carries only
+ /// the generation_id so the caller can correlate the eventual webhook delivery.
+ /// Example: {"generation_id":"generation_id"} + ///
+ public sealed partial class AsyncImageGenerationResponseV4 + { + /// + /// URL-safe base64 ID of the accepted generation. Matches the
+ /// `generation_id` field delivered in the webhook payload, and the
+ /// `{generation_id}` accepted by the generation polling endpoint. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("generation_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string GenerationId { 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. + /// + /// + /// URL-safe base64 ID of the accepted generation. Matches the
+ /// `generation_id` field delivered in the webhook payload, and the
+ /// `{generation_id}` accepted by the generation polling endpoint. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public AsyncImageGenerationResponseV4( + string generationId) + { + this.GenerationId = generationId ?? throw new global::System.ArgumentNullException(nameof(generationId)); + } + + /// + /// Initializes a new instance of the class. + /// + public AsyncImageGenerationResponseV4() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteMember.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteMember.g.cs index 9374e74..e5b6ae1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteMember.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteMember.g.cs @@ -59,5 +59,6 @@ public ColorPaletteMember( public ColorPaletteMember() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithMembers.g.cs index 066478a..6f11d1f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithMembers.g.cs @@ -49,5 +49,6 @@ public ColorPaletteWithMembers( public ColorPaletteWithMembers() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetName.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetName.g.cs index 1554691..4e18d21 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetName.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetName.g.cs @@ -46,5 +46,6 @@ public ColorPaletteWithPresetName( public ColorPaletteWithPresetName() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetNameOrMembers.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetNameOrMembers.g.cs index cf23734..58dd763 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetNameOrMembers.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ColorPaletteWithPresetNameOrMembers.g.cs @@ -26,6 +26,26 @@ namespace Ideogram #endif public bool IsColorPaletteWithPresetName => ColorPaletteWithPresetName != null; + /// + /// + /// + public bool TryPickColorPaletteWithPresetName( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.ColorPaletteWithPresetName? value) + { + value = ColorPaletteWithPresetName; + return IsColorPaletteWithPresetName; + } + + /// + /// + /// + public global::Ideogram.ColorPaletteWithPresetName PickColorPaletteWithPresetName() => IsColorPaletteWithPresetName + ? ColorPaletteWithPresetName! + : throw new global::System.InvalidOperationException($"Expected union variant 'ColorPaletteWithPresetName' but the value was {ToString()}."); + /// /// A color palette represented only via its members. Cannot be used in conjunction with preset name. /// @@ -42,6 +62,26 @@ namespace Ideogram [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(ColorPaletteWithMembers))] #endif public bool IsColorPaletteWithMembers => ColorPaletteWithMembers != null; + + /// + /// + /// + public bool TryPickColorPaletteWithMembers( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.ColorPaletteWithMembers? value) + { + value = ColorPaletteWithMembers; + return IsColorPaletteWithMembers; + } + + /// + /// + /// + public global::Ideogram.ColorPaletteWithMembers PickColorPaletteWithMembers() => IsColorPaletteWithMembers + ? ColorPaletteWithMembers! + : throw new global::System.InvalidOperationException($"Expected union variant 'ColorPaletteWithMembers' but the value was {ToString()}."); /// /// /// @@ -60,6 +100,11 @@ public ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithPres ColorPaletteWithPresetName = value; } + /// + /// + /// + public static ColorPaletteWithPresetNameOrMembers FromColorPaletteWithPresetName(global::Ideogram.ColorPaletteWithPresetName? value) => new ColorPaletteWithPresetNameOrMembers(value); + /// /// /// @@ -78,6 +123,11 @@ public ColorPaletteWithPresetNameOrMembers(global::Ideogram.ColorPaletteWithMemb ColorPaletteWithMembers = value; } + /// + /// + /// + public static ColorPaletteWithPresetNameOrMembers FromColorPaletteWithMembers(global::Ideogram.ColorPaletteWithMembers? value) => new ColorPaletteWithPresetNameOrMembers(value); + /// /// /// @@ -118,8 +168,8 @@ public bool Validate() /// ///
public TResult? Match( - global::System.Func? colorPaletteWithPresetName = null, - global::System.Func? colorPaletteWithMembers = null, + global::System.Func? colorPaletteWithPresetName = null, + global::System.Func? colorPaletteWithMembers = null, bool validate = true) { if (validate) @@ -143,8 +193,32 @@ public bool Validate() /// ///
public void Match( - global::System.Action? colorPaletteWithPresetName = null, - global::System.Action? colorPaletteWithMembers = null, + global::System.Action? colorPaletteWithPresetName = null, + + global::System.Action? colorPaletteWithMembers = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsColorPaletteWithPresetName) + { + colorPaletteWithPresetName?.Invoke(ColorPaletteWithPresetName!); + } + else if (IsColorPaletteWithMembers) + { + colorPaletteWithMembers?.Invoke(ColorPaletteWithMembers!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? colorPaletteWithPresetName = null, + global::System.Action? colorPaletteWithMembers = null, bool validate = true) { if (validate) diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyRequest.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyRequest.Json.g.cs new file mode 100644 index 0000000..b493aa3 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class CreateApiKeyRequest + { + /// + /// 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.CreateApiKeyRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.CreateApiKeyRequest), + jsonSerializerContext) as global::Ideogram.CreateApiKeyRequest; + } + + /// + /// 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.CreateApiKeyRequest? 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.CreateApiKeyRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.CreateApiKeyRequest; + } + + /// + /// 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.CreateApiKeyRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyRequest.g.cs new file mode 100644 index 0000000..ce6a3c9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyRequest.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"label":"label"} + /// + public sealed partial class CreateApiKeyRequest + { + /// + /// User-supplied label shown alongside the key in the management UI. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("label")] + public string? Label { 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. + /// + /// + /// User-supplied label shown alongside the key in the management UI. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public CreateApiKeyRequest( + string? label) + { + this.Label = label; + } + + /// + /// Initializes a new instance of the class. + /// + public CreateApiKeyRequest() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyResponse.g.cs index c2eabe3..0aefecf 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreateApiKeyResponse.g.cs @@ -75,5 +75,6 @@ public CreateApiKeyResponse( public CreateApiKeyResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.CreateDatasetRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreateDatasetRequest.g.cs index f8693fb..c53335a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.CreateDatasetRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreateDatasetRequest.g.cs @@ -42,5 +42,6 @@ public CreateDatasetRequest( public CreateDatasetRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.CreditGrant.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreditGrant.Json.g.cs new file mode 100644 index 0000000..bcaeacf --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreditGrant.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class CreditGrant + { + /// + /// 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.CreditGrant? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.CreditGrant), + jsonSerializerContext) as global::Ideogram.CreditGrant; + } + + /// + /// 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.CreditGrant? 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.CreditGrant), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.CreditGrant; + } + + /// + /// 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.CreditGrant.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CreditGrant.g.cs new file mode 100644 index 0000000..5f4f02e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CreditGrant.g.cs @@ -0,0 +1,127 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"effective_at":"effective_at","amount_consumed":{"amount":1050,"currency_code":"USD"},"expires_at":"expires_at","amount_available":{"amount":1050,"currency_code":"USD"},"grant_id":"grant_id","name":"name","amount_issued":{"amount":1050,"currency_code":"USD"}} + /// + public sealed partial class CreditGrant + { + /// + /// The Metronome grant identifier. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("grant_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string GrantId { get; set; } + + /// + /// The grant name as shown in Metronome (e.g. "Ideogram API Usage"). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("amount_issued")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price AmountIssued { get; set; } + + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("amount_consumed")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price AmountConsumed { get; set; } + + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("amount_available")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price AmountAvailable { get; set; } + + /// + /// ISO-8601 timestamp when the grant becomes effective. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("effective_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string EffectiveAt { get; set; } + + /// + /// ISO-8601 timestamp when the grant expires. Omitted if the grant has no expiration. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] + public string? ExpiresAt { 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. + /// + /// + /// The Metronome grant identifier. + /// + /// + /// The grant name as shown in Metronome (e.g. "Ideogram API Usage"). + /// + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// ISO-8601 timestamp when the grant becomes effective. + /// + /// + /// ISO-8601 timestamp when the grant expires. Omitted if the grant has no expiration. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public CreditGrant( + string grantId, + string name, + global::Ideogram.Price amountIssued, + global::Ideogram.Price amountConsumed, + global::Ideogram.Price amountAvailable, + string effectiveAt, + string? expiresAt) + { + this.GrantId = grantId ?? throw new global::System.ArgumentNullException(nameof(grantId)); + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.AmountIssued = amountIssued ?? throw new global::System.ArgumentNullException(nameof(amountIssued)); + this.AmountConsumed = amountConsumed ?? throw new global::System.ArgumentNullException(nameof(amountConsumed)); + this.AmountAvailable = amountAvailable ?? throw new global::System.ArgumentNullException(nameof(amountAvailable)); + this.EffectiveAt = effectiveAt ?? throw new global::System.ArgumentNullException(nameof(effectiveAt)); + this.ExpiresAt = expiresAt; + } + + /// + /// Initializes a new instance of the class. + /// + public CreditGrant() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.CustomModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.CustomModel.g.cs index 79016ff..ebe638a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.CustomModel.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.CustomModel.g.cs @@ -157,5 +157,6 @@ public CustomModel( public CustomModel() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.Dataset.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.Dataset.g.cs index 7c2596e..4f4bad0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.Dataset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.Dataset.g.cs @@ -93,5 +93,6 @@ public Dataset( public Dataset() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetFile.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetFile.g.cs index b74aaa7..905b1ce 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetFile.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetFile.g.cs @@ -53,5 +53,6 @@ public DatasetFile( public DatasetFile() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadFailedAsset.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadFailedAsset.g.cs index acac99e..25ef364 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadFailedAsset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadFailedAsset.g.cs @@ -54,5 +54,6 @@ public DatasetUploadFailedAsset( public DatasetUploadFailedAsset() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadSucceededAsset.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadSucceededAsset.g.cs index 8cbe384..681338f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadSucceededAsset.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DatasetUploadSucceededAsset.g.cs @@ -56,5 +56,6 @@ public DatasetUploadSucceededAsset( public DatasetUploadSucceededAsset() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeModelVersion.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeModelVersion.g.cs index 5237663..151391c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeModelVersion.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeModelVersion.g.cs @@ -21,6 +21,10 @@ public enum DescribeModelVersion /// ///
V3, + /// + /// + /// + V4, } /// @@ -38,6 +42,7 @@ public static string ToValueString(this DescribeModelVersion value) DescribeModelVersion.Custom => "CUSTOM", DescribeModelVersion.V2 => "V_2", DescribeModelVersion.V3 => "V_3", + DescribeModelVersion.V4 => "V_4", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -51,6 +56,7 @@ public static string ToValueString(this DescribeModelVersion value) "CUSTOM" => DescribeModelVersion.Custom, "V_2" => DescribeModelVersion.V2, "V_3" => DescribeModelVersion.V3, + "V_4" => DescribeModelVersion.V4, _ => null, }; } diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequest.g.cs index c19c7ef..2dfd03b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequest.g.cs @@ -68,5 +68,6 @@ public DescribeRequest( public DescribeRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequestV4.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequestV4.Json.g.cs new file mode 100644 index 0000000..a5c511a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequestV4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class DescribeRequestV4 + { + /// + /// 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.DescribeRequestV4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.DescribeRequestV4), + jsonSerializerContext) as global::Ideogram.DescribeRequestV4; + } + + /// + /// 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.DescribeRequestV4? 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.DescribeRequestV4), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.DescribeRequestV4; + } + + /// + /// 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.DescribeRequestV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequestV4.g.cs new file mode 100644 index 0000000..6641594 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeRequestV4.g.cs @@ -0,0 +1,116 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class DescribeRequestV4 + { + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image_file")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] ImageFile { get; set; } + + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image_filename")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string ImageFilename { get; set; } + + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("include_bbox")] + public bool? IncludeBbox { get; set; } + + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("include_style_descriptions")] + public bool? IncludeStyleDescriptions { get; set; } + + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("include_tags")] + public bool? IncludeTags { 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. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public DescribeRequestV4( + byte[] imageFile, + string imageFilename, + bool? includeBbox, + bool? includeStyleDescriptions, + bool? includeTags) + { + this.ImageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + this.ImageFilename = imageFilename ?? throw new global::System.ArgumentNullException(nameof(imageFilename)); + this.IncludeBbox = includeBbox; + this.IncludeStyleDescriptions = includeStyleDescriptions; + this.IncludeTags = includeTags; + } + + /// + /// Initializes a new instance of the class. + /// + public DescribeRequestV4() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponse.g.cs index f48c749..f4da756 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponse.g.cs @@ -42,5 +42,6 @@ public DescribeResponse( public DescribeResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponseV4.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponseV4.Json.g.cs new file mode 100644 index 0000000..6605f62 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponseV4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class DescribeResponseV4 + { + /// + /// 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.DescribeResponseV4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.DescribeResponseV4), + jsonSerializerContext) as global::Ideogram.DescribeResponseV4; + } + + /// + /// 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.DescribeResponseV4? 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.DescribeResponseV4), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.DescribeResponseV4; + } + + /// + /// 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.DescribeResponseV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponseV4.g.cs new file mode 100644 index 0000000..d273105 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DescribeResponseV4.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The response for an Ideogram 4.0 describe request. The `json_prompt`
+ /// field is a structured `V4JsonPrompt` that can be passed back as
+ /// `json_prompt` to the `/v1/ideogram-v4/generate` family of endpoints.
+ /// Example: {"json_prompt":{"high_level_description":"high_level_description","style_description":{"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"},"compositional_deconstruction":{"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]},"tags":["tags","tags"]}} + ///
+ public sealed partial class DescribeResponseV4 + { + /// + /// Structured prompt for Ideogram 4.0 generation. When `json_prompt` is
+ /// supplied, magic-prompt is disabled and the diffusion model consumes
+ /// the JSON contract directly. Mutually exclusive with `text_prompt`
+ /// and the legacy `prompt` field.
+ /// Example: {"high_level_description":"high_level_description","style_description":{"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"},"compositional_deconstruction":{"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]},"tags":["tags","tags"]} + ///
+ /// {"high_level_description":"high_level_description","style_description":{"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"},"compositional_deconstruction":{"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]},"tags":["tags","tags"]} + [global::System.Text.Json.Serialization.JsonPropertyName("json_prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.V4JsonPrompt JsonPrompt { 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. + /// + /// + /// Structured prompt for Ideogram 4.0 generation. When `json_prompt` is
+ /// supplied, magic-prompt is disabled and the diffusion model consumes
+ /// the JSON contract directly. Mutually exclusive with `text_prompt`
+ /// and the legacy `prompt` field.
+ /// Example: {"high_level_description":"high_level_description","style_description":{"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"},"compositional_deconstruction":{"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]},"tags":["tags","tags"]} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public DescribeResponseV4( + global::Ideogram.V4JsonPrompt jsonPrompt) + { + this.JsonPrompt = jsonPrompt ?? throw new global::System.ArgumentNullException(nameof(jsonPrompt)); + } + + /// + /// Initializes a new instance of the class. + /// + public DescribeResponseV4() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.Description.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.Description.g.cs index 8853e8b..4a5094b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.Description.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.Description.g.cs @@ -44,5 +44,6 @@ public Description( public Description() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.DetectedTextBlock.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.DetectedTextBlock.g.cs index 3ba07b8..3069955 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.DetectedTextBlock.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.DetectedTextBlock.g.cs @@ -202,5 +202,6 @@ public DetectedTextBlock( public DetectedTextBlock() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequest.g.cs index 9734e71..c0ac43c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequest.g.cs @@ -66,6 +66,12 @@ public sealed partial class EditImageRequest [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The number of images to generate.
/// Default Value: 1 @@ -124,6 +130,9 @@ public sealed partial class EditImageRequest /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -147,6 +156,7 @@ public EditImageRequest( string prompt, global::Ideogram.ModelEnum model, global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, int? numImages, int? seed, global::Ideogram.StyleType? styleType) @@ -158,6 +168,7 @@ public EditImageRequest( this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); this.Model = model; this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NumImages = numImages; this.Seed = seed; this.StyleType = styleType; @@ -169,5 +180,6 @@ public EditImageRequest( public EditImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequestV3.g.cs index 0a67f85..7f04c38 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.EditImageRequestV3.g.cs @@ -54,6 +54,12 @@ public sealed partial class EditImageRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The number of images to generate.
/// Default Value: 1 @@ -167,6 +173,9 @@ public sealed partial class EditImageRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -219,6 +228,7 @@ public EditImageRequestV3( string maskname, string prompt, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, int? numImages, int? seed, global::Ideogram.RenderingSpeed? renderingSpeed, @@ -237,6 +247,7 @@ public EditImageRequestV3( this.Maskname = maskname ?? throw new global::System.ArgumentNullException(nameof(maskname)); this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NumImages = numImages; this.Seed = seed; this.RenderingSpeed = renderingSpeed; @@ -256,5 +267,6 @@ public EditImageRequestV3( public EditImageRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV3.g.cs index ed4fd8b..dd0be19 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV3.g.cs @@ -58,6 +58,12 @@ public sealed partial class GenerateDesignRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// Description of what to exclude from a design. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -235,6 +241,9 @@ public sealed partial class GenerateDesignRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from a design. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -318,6 +327,7 @@ public GenerateDesignRequestV3( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.RenderingSpeed? renderingSpeed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, string? negativePrompt, int? numImages, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette, @@ -346,6 +356,7 @@ public GenerateDesignRequestV3( this.AspectRatio = aspectRatio; this.RenderingSpeed = renderingSpeed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NegativePrompt = negativePrompt; this.NumImages = numImages; this.ColorPalette = colorPalette; @@ -375,5 +386,6 @@ public GenerateDesignRequestV3( public GenerateDesignRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4.Json.g.cs new file mode 100644 index 0000000..884e20a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class GenerateDesignRequestV4 + { + /// + /// 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.GenerateDesignRequestV4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.GenerateDesignRequestV4), + jsonSerializerContext) as global::Ideogram.GenerateDesignRequestV4; + } + + /// + /// 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.GenerateDesignRequestV4? 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.GenerateDesignRequestV4), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.GenerateDesignRequestV4; + } + + /// + /// 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.GenerateDesignRequestV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4.g.cs new file mode 100644 index 0000000..7077ff8 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4.g.cs @@ -0,0 +1,188 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class GenerateDesignRequestV4 + { + /// + /// The text prompt for editable design generation. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// Random seed for reproducibility. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + public int? Seed { get; set; } + + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + ///
+ /// ON + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_option")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] + public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + ///
+ /// 1024x1024 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4LayoutJsonConverter))] + public global::Ideogram.ResolutionV4Layout? Resolution { get; set; } + + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("rendering_speed")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter))] + public global::Ideogram.RenderingSpeed? RenderingSpeed { get; set; } + + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("inspiration_reference_images")] + public global::System.Collections.Generic.IList? InspirationReferenceImages { get; set; } + + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("inspiration_reference_model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4InspirationReferenceModelJsonConverter))] + public global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? InspirationReferenceModel { get; set; } + + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("artifact_generation_model")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ArtifactGenerationModelJsonConverter))] + public global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? ArtifactGenerationModel { get; set; } + + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("layout2image_variant")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4Layout2imageVariantJsonConverter))] + public global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? Layout2imageVariant { get; set; } + + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerateDesignRequestV4ResponseTypeJsonConverter))] + public global::Ideogram.GenerateDesignRequestV4ResponseType? ResponseType { 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. + /// + /// + /// The text prompt for editable design generation. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported. + /// + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + /// + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + /// + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerateDesignRequestV4( + string prompt, + int? seed, + global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, + global::Ideogram.ResolutionV4Layout? resolution, + global::Ideogram.RenderingSpeed? renderingSpeed, + global::System.Collections.Generic.IList? inspirationReferenceImages, + global::Ideogram.GenerateDesignRequestV4InspirationReferenceModel? inspirationReferenceModel, + global::Ideogram.GenerateDesignRequestV4ArtifactGenerationModel? artifactGenerationModel, + global::Ideogram.GenerateDesignRequestV4Layout2imageVariant? layout2imageVariant, + global::Ideogram.GenerateDesignRequestV4ResponseType? responseType) + { + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Seed = seed; + this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; + this.Resolution = resolution; + this.RenderingSpeed = renderingSpeed; + this.InspirationReferenceImages = inspirationReferenceImages; + this.InspirationReferenceModel = inspirationReferenceModel; + this.ArtifactGenerationModel = artifactGenerationModel; + this.Layout2imageVariant = layout2imageVariant; + this.ResponseType = responseType; + } + + /// + /// Initializes a new instance of the class. + /// + public GenerateDesignRequestV4() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ArtifactGenerationModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ArtifactGenerationModel.g.cs new file mode 100644 index 0000000..804537d --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ArtifactGenerationModel.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Experimental. Model to use for the HTML/layout and base-plate handoff generation call.
+ /// Default Value: claude-sonnet-4-6 + ///
+ public enum GenerateDesignRequestV4ArtifactGenerationModel + { + /// + /// + /// + ClaudeOpus46, + /// + /// + /// + ClaudeOpus47, + /// + /// + /// + ClaudeSonnet46, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateDesignRequestV4ArtifactGenerationModelExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateDesignRequestV4ArtifactGenerationModel value) + { + return value switch + { + GenerateDesignRequestV4ArtifactGenerationModel.ClaudeOpus46 => "claude-opus-4-6", + GenerateDesignRequestV4ArtifactGenerationModel.ClaudeOpus47 => "claude-opus-4-7", + GenerateDesignRequestV4ArtifactGenerationModel.ClaudeSonnet46 => "claude-sonnet-4-6", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateDesignRequestV4ArtifactGenerationModel? ToEnum(string value) + { + return value switch + { + "claude-opus-4-6" => GenerateDesignRequestV4ArtifactGenerationModel.ClaudeOpus46, + "claude-opus-4-7" => GenerateDesignRequestV4ArtifactGenerationModel.ClaudeOpus47, + "claude-sonnet-4-6" => GenerateDesignRequestV4ArtifactGenerationModel.ClaudeSonnet46, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4InspirationReferenceModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4InspirationReferenceModel.g.cs new file mode 100644 index 0000000..5942ba9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4InspirationReferenceModel.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Experimental. Model to use for the inspiration vision prepass.
+ /// Default Value: claude-sonnet-4-6 + ///
+ public enum GenerateDesignRequestV4InspirationReferenceModel + { + /// + /// + /// + ClaudeOpus46, + /// + /// + /// + ClaudeOpus47, + /// + /// + /// + ClaudeSonnet46, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateDesignRequestV4InspirationReferenceModelExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateDesignRequestV4InspirationReferenceModel value) + { + return value switch + { + GenerateDesignRequestV4InspirationReferenceModel.ClaudeOpus46 => "claude-opus-4-6", + GenerateDesignRequestV4InspirationReferenceModel.ClaudeOpus47 => "claude-opus-4-7", + GenerateDesignRequestV4InspirationReferenceModel.ClaudeSonnet46 => "claude-sonnet-4-6", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateDesignRequestV4InspirationReferenceModel? ToEnum(string value) + { + return value switch + { + "claude-opus-4-6" => GenerateDesignRequestV4InspirationReferenceModel.ClaudeOpus46, + "claude-opus-4-7" => GenerateDesignRequestV4InspirationReferenceModel.ClaudeOpus47, + "claude-sonnet-4-6" => GenerateDesignRequestV4InspirationReferenceModel.ClaudeSonnet46, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4Layout2imageVariant.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4Layout2imageVariant.g.cs new file mode 100644 index 0000000..032f078 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4Layout2imageVariant.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Experimental. Staging only. Select a v4 layout-to-image pipeline variant.
+ /// Omit for the default v4l2i path. Rejected on production. + ///
+ public enum GenerateDesignRequestV4Layout2imageVariant + { + /// + /// + /// + BboxAware, + /// + /// + /// + Opus47, + /// + /// + /// + SeparateImageLayer, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateDesignRequestV4Layout2imageVariantExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateDesignRequestV4Layout2imageVariant value) + { + return value switch + { + GenerateDesignRequestV4Layout2imageVariant.BboxAware => "bbox_aware", + GenerateDesignRequestV4Layout2imageVariant.Opus47 => "opus_4_7", + GenerateDesignRequestV4Layout2imageVariant.SeparateImageLayer => "separate_image_layer", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateDesignRequestV4Layout2imageVariant? ToEnum(string value) + { + return value switch + { + "bbox_aware" => GenerateDesignRequestV4Layout2imageVariant.BboxAware, + "opus_4_7" => GenerateDesignRequestV4Layout2imageVariant.Opus47, + "separate_image_layer" => GenerateDesignRequestV4Layout2imageVariant.SeparateImageLayer, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ResponseType.g.cs new file mode 100644 index 0000000..3e447a5 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateDesignRequestV4ResponseType.g.cs @@ -0,0 +1,67 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// layered (default): full editable design payload with text layers and HTML.
+ /// url: JSON with an expiring link to the final composited cover image.
+ /// binary: raw PNG bytes of the final composited cover image (Content-Type image/png).
+ /// html: raw HTML document of the generated layout (Content-Type text/html).
+ /// Default Value: layered + ///
+ public enum GenerateDesignRequestV4ResponseType + { + /// + /// raw PNG bytes of the final composited cover image (Content-Type image/png). + /// + Binary, + /// + /// raw HTML document of the generated layout (Content-Type text/html). + /// + Html, + /// + /// full editable design payload with text layers and HTML. + /// + Layered, + /// + /// JSON with an expiring link to the final composited cover image. + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateDesignRequestV4ResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateDesignRequestV4ResponseType value) + { + return value switch + { + GenerateDesignRequestV4ResponseType.Binary => "binary", + GenerateDesignRequestV4ResponseType.Html => "html", + GenerateDesignRequestV4ResponseType.Layered => "layered", + GenerateDesignRequestV4ResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateDesignRequestV4ResponseType? ToEnum(string value) + { + return value switch + { + "binary" => GenerateDesignRequestV4ResponseType.Binary, + "html" => GenerateDesignRequestV4ResponseType.Html, + "layered" => GenerateDesignRequestV4ResponseType.Layered, + "url" => GenerateDesignRequestV4ResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateGraphicRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateGraphicRequestV3.g.cs index bda768e..dea40a2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateGraphicRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateGraphicRequestV3.g.cs @@ -57,6 +57,12 @@ public sealed partial class GenerateGraphicRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// Description of what to exclude from a graphic. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -246,6 +252,9 @@ public sealed partial class GenerateGraphicRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from a graphic. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -335,6 +344,7 @@ public GenerateGraphicRequestV3( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.RenderingSpeed? renderingSpeed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, string? negativePrompt, int? numImages, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette, @@ -365,6 +375,7 @@ public GenerateGraphicRequestV3( this.AspectRatio = aspectRatio; this.RenderingSpeed = renderingSpeed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NegativePrompt = negativePrompt; this.NumImages = numImages; this.ColorPalette = colorPalette; @@ -396,5 +407,6 @@ public GenerateGraphicRequestV3( public GenerateGraphicRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequest.g.cs index 2f4ae6b..1a4b76f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequest.g.cs @@ -43,5 +43,6 @@ public GenerateImageRequest( public GenerateImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV3.g.cs index 49bf5d8..c978de1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV3.g.cs @@ -58,6 +58,12 @@ public sealed partial class GenerateImageRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -135,6 +141,16 @@ public sealed partial class GenerateImageRequestV3 [global::System.Text.Json.Serialization.JsonPropertyName("character_reference_images_mask")] public global::System.Collections.Generic.IList? CharacterReferenceImagesMask { get; set; } + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`: if the org has it on, this is ignored;
+ /// if the org has it off, setting this `true` enables detection for this request only.
+ /// Adds detection latency. Flagged images come back with `is_image_safe: false`. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("enable_copyright_detection")] + public bool? EnableCopyrightDetection { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -167,6 +183,9 @@ public sealed partial class GenerateImageRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -206,6 +225,13 @@ public sealed partial class GenerateImageRequestV3 /// /// Optional masks for character reference images. When provided, must match the number of character_reference_images. Each mask should be a grayscale image of the same dimensions as the corresponding character reference image. The images should be in JPEG, PNG or WebP format. /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`: if the org has it on, this is ignored;
+ /// if the org has it off, setting this `true` enables detection for this request only.
+ /// Adds detection latency. Flagged images come back with `is_image_safe: false`. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -216,6 +242,7 @@ public GenerateImageRequestV3( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.RenderingSpeed? renderingSpeed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, string? negativePrompt, int? numImages, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette, @@ -225,7 +252,8 @@ public GenerateImageRequestV3( string? customModelUri, global::System.Collections.Generic.IList? styleReferenceImages, global::System.Collections.Generic.IList? characterReferenceImages, - global::System.Collections.Generic.IList? characterReferenceImagesMask) + global::System.Collections.Generic.IList? characterReferenceImagesMask, + bool? enableCopyrightDetection) { this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); this.Seed = seed; @@ -233,6 +261,7 @@ public GenerateImageRequestV3( this.AspectRatio = aspectRatio; this.RenderingSpeed = renderingSpeed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NegativePrompt = negativePrompt; this.NumImages = numImages; this.ColorPalette = colorPalette; @@ -243,6 +272,7 @@ public GenerateImageRequestV3( this.StyleReferenceImages = styleReferenceImages; this.CharacterReferenceImages = characterReferenceImages; this.CharacterReferenceImagesMask = characterReferenceImagesMask; + this.EnableCopyrightDetection = enableCopyrightDetection; } /// @@ -251,5 +281,6 @@ public GenerateImageRequestV3( public GenerateImageRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4.g.cs index e9111e3..30dd06f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4.g.cs @@ -4,16 +4,30 @@ namespace Ideogram { /// - /// + /// Request body for Ideogram 4.0 image generation. Supply exactly one of
+ /// `text_prompt` or `json_prompt`. When `text_prompt` is supplied,
+ /// magic-prompt is applied automatically. When `json_prompt` is supplied,
+ /// magic-prompt is skipped and the structured prompt is consumed
+ /// directly. ///
public sealed partial class GenerateImageRequestV4 { /// - /// The text prompt for image generation. + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. ///
- [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Prompt { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("text_prompt")] + public string? TextPrompt { get; set; } + + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("json_prompt")] + public global::Ideogram.V4JsonPrompt? JsonPrompt { get; set; } /// /// Random seed for reproducibility. @@ -22,13 +36,12 @@ public sealed partial class GenerateImageRequestV4 public int? Seed { get; set; } /// - /// Determine if MagicPrompt should be used in generating the request or not.
- /// Example: ON + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. ///
- /// ON - [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_option")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] - public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } /// /// A custom model URI in the format model/<model_name>/version/<version_name>.
@@ -39,6 +52,32 @@ public sealed partial class GenerateImageRequestV4 [global::System.Text.Json.Serialization.JsonPropertyName("custom_model_uri")] public string? CustomModelUri { get; set; } + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + ///
+ /// 2048x2048 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter))] + public global::Ideogram.ResolutionV4? Resolution { get; set; } + + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("rendering_speed")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter))] + public global::Ideogram.RenderingSpeed? RenderingSpeed { get; set; } + + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("enable_copyright_detection")] + public bool? EnableCopyrightDetection { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -48,34 +87,65 @@ public sealed partial class GenerateImageRequestV4 /// /// Initializes a new instance of the class. /// - /// - /// The text prompt for image generation. + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. /// /// /// Random seed for reproducibility. /// - /// - /// Determine if MagicPrompt should be used in generating the request or not.
- /// Example: ON + /// + /// A base64url-encoded magic prompt system prompt config ID to use
+ /// for this request. Honored when `text_prompt` is supplied. Ignored
+ /// when `json_prompt` is supplied. /// /// /// A custom model URI in the format model/<model_name>/version/<version_name>.
/// When provided, the model version and style will be resolved from this URI.
/// Example: model/my-custom-model/version/0 /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). The effective gate is the OR of this field and the organization's
+ /// `copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public GenerateImageRequestV4( - string prompt, + string? textPrompt, + global::Ideogram.V4JsonPrompt? jsonPrompt, int? seed, - global::Ideogram.MagicPromptOption? magicPromptOption, - string? customModelUri) + string? magicPromptSystemPromptConfigId, + string? customModelUri, + global::Ideogram.ResolutionV4? resolution, + global::Ideogram.RenderingSpeed? renderingSpeed, + bool? enableCopyrightDetection) { - this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.TextPrompt = textPrompt; + this.JsonPrompt = jsonPrompt; this.Seed = seed; - this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.CustomModelUri = customModelUri; + this.Resolution = resolution; + this.RenderingSpeed = renderingSpeed; + this.EnableCopyrightDetection = enableCopyrightDetection; } /// @@ -84,5 +154,6 @@ public GenerateImageRequestV4( public GenerateImageRequestV4() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Im2Im.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Im2Im.Json.g.cs new file mode 100644 index 0000000..aac9f3c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Im2Im.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class GenerateImageRequestV4Im2Im + { + /// + /// 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.GenerateImageRequestV4Im2Im? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.GenerateImageRequestV4Im2Im), + jsonSerializerContext) as global::Ideogram.GenerateImageRequestV4Im2Im; + } + + /// + /// 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.GenerateImageRequestV4Im2Im? 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.GenerateImageRequestV4Im2Im), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.GenerateImageRequestV4Im2Im; + } + + /// + /// 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.GenerateImageRequestV4Im2Im.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Im2Im.g.cs new file mode 100644 index 0000000..f12b535 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Im2Im.g.cs @@ -0,0 +1,154 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class GenerateImageRequestV4Im2Im + { + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Image { get; set; } + + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("imagename")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Imagename { get; set; } + + /// + /// An optional text prompt to guide the generation. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + public string? Prompt { get; set; } + + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + ///
+ /// 12345 + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + public int? Seed { get; set; } + + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + ///
+ /// ON + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_option")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] + public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + ///
+ /// 1024x1024 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4ImageToImageJsonConverter))] + public global::Ideogram.ResolutionV4ImageToImage? Resolution { get; set; } + + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("rendering_speed")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter))] + public global::Ideogram.RenderingSpeed? RenderingSpeed { get; set; } + + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("enable_copyright_detection")] + public bool? EnableCopyrightDetection { 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. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// An optional text prompt to guide the generation. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// Determine if MagicPrompt should be used in generating the request or not.
+ /// Example: ON + /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`
+ /// is coming soon; requests with `rendering_speed=FLASH` currently
+ /// return a 400. + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerateImageRequestV4Im2Im( + byte[] image, + string imagename, + string? prompt, + int? seed, + global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, + global::Ideogram.ResolutionV4ImageToImage? resolution, + global::Ideogram.RenderingSpeed? renderingSpeed, + bool? enableCopyrightDetection) + { + this.Image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); + this.Prompt = prompt; + this.Seed = seed; + this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; + this.Resolution = resolution; + this.RenderingSpeed = renderingSpeed; + this.EnableCopyrightDetection = enableCopyrightDetection; + } + + /// + /// Initializes a new instance of the class. + /// + public GenerateImageRequestV4Im2Im() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Stable.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Stable.Json.g.cs new file mode 100644 index 0000000..ab9bdb1 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Stable.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class GenerateImageRequestV4Stable + { + /// + /// 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.GenerateImageRequestV4Stable? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.GenerateImageRequestV4Stable), + jsonSerializerContext) as global::Ideogram.GenerateImageRequestV4Stable; + } + + /// + /// 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.GenerateImageRequestV4Stable? 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.GenerateImageRequestV4Stable), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.GenerateImageRequestV4Stable; + } + + /// + /// 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.GenerateImageRequestV4Stable.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Stable.g.cs new file mode 100644 index 0000000..f189e5c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4Stable.g.cs @@ -0,0 +1,113 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Request body for the stable Ideogram 4.0 endpoint. Supply exactly one
+ /// of `text_prompt` or `json_prompt`. The model URI is pinned
+ /// server-side. When `resolution` is omitted, the server chooses an
+ /// aspect ratio automatically. + ///
+ public sealed partial class GenerateImageRequestV4Stable + { + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("text_prompt")] + public string? TextPrompt { get; set; } + + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("json_prompt")] + public global::Ideogram.V4JsonPrompt? JsonPrompt { get; set; } + + /// + /// Random seed for reproducibility. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + public int? Seed { get; set; } + + /// + /// Optional. When supplied, the image is generated at this
+ /// resolution. When omitted, the server picks an aspect ratio
+ /// automatically based on the prompt. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter))] + public global::Ideogram.ResolutionV4? Resolution { get; set; } + + /// + /// Optional. Selects a specific pinned stable build. When omitted,
+ /// the default stable model URI is used. When set to `stable_may29`,
+ /// the request is routed to the May 29th stable build. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("version")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerateImageRequestV4StableVersionJsonConverter))] + public global::Ideogram.GenerateImageRequestV4StableVersion? Version { 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. + /// + /// + /// A natural-language prompt for image generation. When supplied,
+ /// magic-prompt is enabled automatically. Mutually exclusive with
+ /// `json_prompt`. + /// + /// + /// A structured prompt that conforms to the Ideogram 4.0 JSON
+ /// contract. When supplied, magic-prompt is disabled and the
+ /// structured prompt is consumed by the diffusion model directly.
+ /// Mutually exclusive with `text_prompt`. + /// + /// + /// Random seed for reproducibility. + /// + /// + /// Optional. When supplied, the image is generated at this
+ /// resolution. When omitted, the server picks an aspect ratio
+ /// automatically based on the prompt. + /// + /// + /// Optional. Selects a specific pinned stable build. When omitted,
+ /// the default stable model URI is used. When set to `stable_may29`,
+ /// the request is routed to the May 29th stable build. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerateImageRequestV4Stable( + string? textPrompt, + global::Ideogram.V4JsonPrompt? jsonPrompt, + int? seed, + global::Ideogram.ResolutionV4? resolution, + global::Ideogram.GenerateImageRequestV4StableVersion? version) + { + this.TextPrompt = textPrompt; + this.JsonPrompt = jsonPrompt; + this.Seed = seed; + this.Resolution = resolution; + this.Version = version; + } + + /// + /// Initializes a new instance of the class. + /// + public GenerateImageRequestV4Stable() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4StableVersion.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4StableVersion.g.cs new file mode 100644 index 0000000..6ffac03 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageRequestV4StableVersion.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Optional. Selects a specific pinned stable build. When omitted,
+ /// the default stable model URI is used. When set to `stable_may29`,
+ /// the request is routed to the May 29th stable build. + ///
+ public enum GenerateImageRequestV4StableVersion + { + /// + /// + /// + StableMay29, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateImageRequestV4StableVersionExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateImageRequestV4StableVersion value) + { + return value switch + { + GenerateImageRequestV4StableVersion.StableMay29 => "stable_may29", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateImageRequestV4StableVersion? ToEnum(string value) + { + return value switch + { + "stable_may29" => GenerateImageRequestV4StableVersion.StableMay29, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageResponse.g.cs index f0007eb..70b12b4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageResponse.g.cs @@ -6,10 +6,19 @@ namespace Ideogram /// /// The response which contains information about the generated image, including the download link.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it.
- /// Example: {"data":[{"style_type":"REALISTIC","seed":12345,"upscaled_resolution":"4096x4096","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","resolution":"1024x1024","url":"https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g","is_image_safe":true},{"style_type":"REALISTIC","seed":12345,"upscaled_resolution":"4096x4096","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","resolution":"1024x1024","url":"https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g","is_image_safe":true}],"created":"2000-01-23T04:56:07\u002B00:00"} + /// Example: {"data":[{"style_type":"REALISTIC","seed":12345,"upscaled_resolution":"4096x4096","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","resolution":"1024x1024","url":"https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g","is_image_safe":true},{"style_type":"REALISTIC","seed":12345,"upscaled_resolution":"4096x4096","prompt":"A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.","resolution":"1024x1024","url":"https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g","is_image_safe":true}],"created":"2000-01-23T04:56:07\u002B00:00","request_id":"request_id"} ///
public sealed partial class GenerateImageResponse { + /// + /// URL-safe base64 ID of the sampling request. Present when the caller
+ /// supplied `webhook_url` and the request was accepted for async
+ /// delivery; in that case `data` is omitted and the generated images
+ /// will be POSTed to the customer's `webhook_url` when ready. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("request_id")] + public string? RequestId { get; set; } + /// /// The time the request was created. /// @@ -21,8 +30,7 @@ public sealed partial class GenerateImageResponse /// A list of ImageObjects that contain the generated image(s). ///
[global::System.Text.Json.Serialization.JsonPropertyName("data")] - [global::System.Text.Json.Serialization.JsonRequired] - public required global::System.Collections.Generic.IList Data { get; set; } + public global::System.Collections.Generic.IList? Data { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -36,6 +44,12 @@ public sealed partial class GenerateImageResponse /// /// The time the request was created. /// + /// + /// URL-safe base64 ID of the sampling request. Present when the caller
+ /// supplied `webhook_url` and the request was accepted for async
+ /// delivery; in that case `data` is omitted and the generated images
+ /// will be POSTed to the customer's `webhook_url` when ready. + /// /// /// A list of ImageObjects that contain the generated image(s). /// @@ -44,10 +58,12 @@ public sealed partial class GenerateImageResponse #endif public GenerateImageResponse( global::System.DateTime created, - global::System.Collections.Generic.IList data) + string? requestId, + global::System.Collections.Generic.IList? data) { + this.RequestId = requestId; this.Created = created; - this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + this.Data = data; } /// @@ -56,5 +72,6 @@ public GenerateImageResponse( public GenerateImageResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageSafetyError.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageSafetyError.g.cs index 67159ac..4de077b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageSafetyError.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateImageSafetyError.g.cs @@ -43,5 +43,6 @@ public GenerateImageSafetyError( public GenerateImageSafetyError() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateTransparentImageRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateTransparentImageRequestV3.g.cs index a9aec53..78c1484 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GenerateTransparentImageRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerateTransparentImageRequestV3.g.cs @@ -59,6 +59,12 @@ public sealed partial class GenerateTransparentImageRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -118,6 +124,9 @@ public sealed partial class GenerateTransparentImageRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -143,6 +152,7 @@ public GenerateTransparentImageRequestV3( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.RenderingSpeed? renderingSpeed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, string? negativePrompt, int? numImages, string? customModelUri) @@ -153,6 +163,7 @@ public GenerateTransparentImageRequestV3( this.AspectRatio = aspectRatio; this.RenderingSpeed = renderingSpeed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NegativePrompt = negativePrompt; this.NumImages = numImages; this.CustomModelUri = customModelUri; @@ -164,5 +175,6 @@ public GenerateTransparentImageRequestV3( public GenerateTransparentImageRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponse.Json.g.cs new file mode 100644 index 0000000..3f93ffc --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class GenerationResponse + { + /// + /// 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.GenerationResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.GenerationResponse), + jsonSerializerContext) as global::Ideogram.GenerationResponse; + } + + /// + /// 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.GenerationResponse? 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.GenerationResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.GenerationResponse; + } + + /// + /// 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.GenerationResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponse.g.cs new file mode 100644 index 0000000..af600c1 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponse.g.cs @@ -0,0 +1,96 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The current status and, when complete, result data for an asynchronous generation.
+ /// Example: {"data":[{"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true},{"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true}],"generation_id":"generation_id","created":"2000-01-23T04:56:07\u002B00:00","response_type":"url","status":"pending"} + ///
+ public sealed partial class GenerationResponse + { + /// + /// URL-safe base64 ID of the generation. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("generation_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string GenerationId { get; set; } + + /// + /// Current status of the generation. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("status")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerationResponseStatusJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.GenerationResponseStatus Status { get; set; } + + /// + /// The time the generation was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime Created { get; set; } + + /// + /// Present when `status` is `completed`; always "url" for this shape. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.GenerationResponseResponseTypeJsonConverter))] + public global::Ideogram.GenerationResponseResponseType? ResponseType { get; set; } + + /// + /// A list of generated images. Present when `status` is `completed`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + public global::System.Collections.Generic.IList? Data { 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. + /// + /// + /// URL-safe base64 ID of the generation. + /// + /// + /// Current status of the generation. + /// + /// + /// The time the generation was created. + /// + /// + /// Present when `status` is `completed`; always "url" for this shape. + /// + /// + /// A list of generated images. Present when `status` is `completed`. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GenerationResponse( + string generationId, + global::Ideogram.GenerationResponseStatus status, + global::System.DateTime created, + global::Ideogram.GenerationResponseResponseType? responseType, + global::System.Collections.Generic.IList? data) + { + this.GenerationId = generationId ?? throw new global::System.ArgumentNullException(nameof(generationId)); + this.Status = status; + this.Created = created; + this.ResponseType = responseType; + this.Data = data; + } + + /// + /// Initializes a new instance of the class. + /// + public GenerationResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseResponseType.g.cs new file mode 100644 index 0000000..bf84403 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Present when `status` is `completed`; always "url" for this shape. + /// + public enum GenerationResponseResponseType + { + /// + /// + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerationResponseResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerationResponseResponseType value) + { + return value switch + { + GenerationResponseResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerationResponseResponseType? ToEnum(string value) + { + return value switch + { + "url" => GenerationResponseResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseStatus.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseStatus.g.cs new file mode 100644 index 0000000..bfc6b12 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GenerationResponseStatus.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Current status of the generation. + /// + public enum GenerationResponseStatus + { + /// + /// + /// + Completed, + /// + /// + /// + Failed, + /// + /// + /// + Pending, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerationResponseStatusExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerationResponseStatus value) + { + return value switch + { + GenerationResponseStatus.Completed => "completed", + GenerationResponseStatus.Failed => "failed", + GenerationResponseStatus.Pending => "pending", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerationResponseStatus? ToEnum(string value) + { + return value switch + { + "completed" => GenerationResponseStatus.Completed, + "failed" => GenerationResponseStatus.Failed, + "pending" => GenerationResponseStatus.Pending, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.cs index 6a2d779..0301e54 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysResponse.g.cs @@ -43,5 +43,6 @@ public GetApiKeysResponse( public GetApiKeysResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysV2Response.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysV2Response.g.cs index 4bce556..234f77d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysV2Response.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiKeysV2Response.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}]} + /// Example: {"api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}]} /// public sealed partial class GetApiKeysV2Response { @@ -44,5 +44,6 @@ public GetApiKeysV2Response( public GetApiKeysV2Response() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiOrganizationUserSuggestionsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiOrganizationUserSuggestionsResponse.g.cs index a20bc17..d8e5f07 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiOrganizationUserSuggestionsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiOrganizationUserSuggestionsResponse.g.cs @@ -44,5 +44,6 @@ public GetApiOrganizationUserSuggestionsResponse( public GetApiOrganizationUserSuggestionsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.cs index 4808dea..6fccfe2 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiProfilesResponse.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"profiles":[{"is_metronome_2_user":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10},{"is_metronome_2_user":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10}]} + /// Example: {"profiles":[{"is_metronome_2_user":true,"copyright_detection_enabled":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10},{"is_metronome_2_user":true,"copyright_detection_enabled":true,"role":"OWNER","avatar_url":"https://example.com/avatar.jpg","organization_id":"b3JnYW5pemF0aW9uXzEyMw","name":"Gamma","type":"INDIVIDUAL","api_keys":[{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null},{"creation_time":"2000-01-23T04:56:07\u002B00:00","label":"Live production environment","redacted_api_key":"ATG56\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022","api_key_id":"JRPVD7jWR1aTBYiJ0UFVOg","status":null}],"max_num_inflight_requests_permitted":10}]} /// public sealed partial class GetApiProfilesResponse { @@ -44,5 +44,6 @@ public GetApiProfilesResponse( public GetApiProfilesResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiTermsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiTermsResponse.g.cs index f095053..6a1e8de 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetApiTermsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetApiTermsResponse.g.cs @@ -43,5 +43,6 @@ public GetApiTermsResponse( public GetApiTermsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetDatasetResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetDatasetResponse.g.cs index feda376..72992bd 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetDatasetResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetDatasetResponse.g.cs @@ -86,5 +86,6 @@ public GetDatasetResponse( public GetDatasetResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetModelResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetModelResponse.g.cs index 968bad6..d0c723e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetModelResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetModelResponse.g.cs @@ -45,5 +45,6 @@ public GetModelResponse( public GetModelResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationBillingPortalResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationBillingPortalResponse.Json.g.cs new file mode 100644 index 0000000..1f187d6 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationBillingPortalResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class GetOrganizationBillingPortalResponse + { + /// + /// 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.GetOrganizationBillingPortalResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.GetOrganizationBillingPortalResponse), + jsonSerializerContext) as global::Ideogram.GetOrganizationBillingPortalResponse; + } + + /// + /// 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.GetOrganizationBillingPortalResponse? 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.GetOrganizationBillingPortalResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.GetOrganizationBillingPortalResponse; + } + + /// + /// 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.GetOrganizationBillingPortalResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationBillingPortalResponse.g.cs new file mode 100644 index 0000000..b1b145a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationBillingPortalResponse.g.cs @@ -0,0 +1,58 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"has_stripe_setup":true,"stripe_billing_url":"stripe_billing_url"} + /// + public sealed partial class GetOrganizationBillingPortalResponse + { + /// + /// Whether or not Stripe billing is set up for the organization's API usage. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("has_stripe_setup")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool HasStripeSetup { get; set; } + + /// + /// The URL for an organization admin to manage the organization's Stripe billing, including adding or removing payment methods. Absent when no Stripe customer exists for the organization. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("stripe_billing_url")] + public string? StripeBillingUrl { 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. + /// + /// + /// Whether or not Stripe billing is set up for the organization's API usage. + /// + /// + /// The URL for an organization admin to manage the organization's Stripe billing, including adding or removing payment methods. Absent when no Stripe customer exists for the organization. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public GetOrganizationBillingPortalResponse( + bool hasStripeSetup, + string? stripeBillingUrl) + { + this.HasStripeSetup = hasStripeSetup; + this.StripeBillingUrl = stripeBillingUrl; + } + + /// + /// Initializes a new instance of the class. + /// + public GetOrganizationBillingPortalResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationMembersResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationMembersResponse.g.cs index 4faa55d..d8f2e4a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationMembersResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetOrganizationMembersResponse.g.cs @@ -44,5 +44,6 @@ public GetOrganizationMembersResponse( public GetOrganizationMembersResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetUsageInfoResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetUsageInfoResponse.g.cs index 1e37ea3..8ee2c38 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetUsageInfoResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetUsageInfoResponse.g.cs @@ -42,5 +42,6 @@ public GetUsageInfoResponse( public GetUsageInfoResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.GetUserCreditsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.GetUserCreditsResponse.g.cs index c2bc7c9..ecfd346 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.GetUserCreditsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.GetUserCreditsResponse.g.cs @@ -74,5 +74,6 @@ public GetUserCreditsResponse( public GetUserCreditsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObject.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObject.Json.g.cs new file mode 100644 index 0000000..1aafd08 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObject.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ImageGenerationObject + { + /// + /// 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.ImageGenerationObject? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ImageGenerationObject), + jsonSerializerContext) as global::Ideogram.ImageGenerationObject; + } + + /// + /// 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.ImageGenerationObject? 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.ImageGenerationObject), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ImageGenerationObject; + } + + /// + /// 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.ImageGenerationObject.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObject.g.cs new file mode 100644 index 0000000..b5915e4 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObject.g.cs @@ -0,0 +1,104 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// A single generated image. Model-agnostic shape returned by the generation polling endpoint.
+ /// Example: {"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true} + ///
+ public sealed partial class ImageGenerationObject + { + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + ///
+ /// https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// The resolution of the generated image, formatted as "{width}x{height}".
+ /// Example: 2048x2048 + ///
+ /// 2048x2048 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Resolution { get; set; } + + /// + /// Whether this image passes safety checks. If false, the url field will be empty. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_image_safe")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool IsImageSafe { get; set; } + + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + ///
+ /// 12345 + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Seed { 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. + /// + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + /// + /// The resolution of the generated image, formatted as "{width}x{height}".
+ /// Example: 2048x2048 + /// + /// + /// Whether this image passes safety checks. If false, the url field will be empty. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageGenerationObject( + string prompt, + string resolution, + bool isImageSafe, + int seed, + string? url) + { + this.Url = url; + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Resolution = resolution ?? throw new global::System.ArgumentNullException(nameof(resolution)); + this.IsImageSafe = isImageSafe; + this.Seed = seed; + } + + /// + /// Initializes a new instance of the class. + /// + public ImageGenerationObject() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV3.g.cs index a487fd3..a2fe6bd 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV3.g.cs @@ -133,5 +133,6 @@ public ImageGenerationObjectV3( public ImageGenerationObjectV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4.g.cs index 5483ae9..54eb5ff 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"seed":12345,"prompt":"prompt","resolution":"1280x800","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true} + /// Example: {"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true} /// public sealed partial class ImageGenerationObjectV4 { @@ -24,10 +24,10 @@ public sealed partial class ImageGenerationObjectV4 public required string Prompt { get; set; } /// - /// The resolutions supported for Ideogram 4.0.
- /// Example: 1280x800 + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 ///
- /// 1280x800 + /// 2048x2048 [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] @@ -62,8 +62,8 @@ public sealed partial class ImageGenerationObjectV4 /// The prompt used for the generation. This may be different from the original prompt. /// /// - /// The resolutions supported for Ideogram 4.0.
- /// Example: 1280x800 + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 /// /// /// Whether this request passes safety checks. If false, the url field will be empty. @@ -99,5 +99,6 @@ public ImageGenerationObjectV4( public ImageGenerationObjectV4() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4ImageToImage.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4ImageToImage.Json.g.cs new file mode 100644 index 0000000..1ff5c89 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4ImageToImage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ImageGenerationObjectV4ImageToImage + { + /// + /// 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.ImageGenerationObjectV4ImageToImage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ImageGenerationObjectV4ImageToImage), + jsonSerializerContext) as global::Ideogram.ImageGenerationObjectV4ImageToImage; + } + + /// + /// 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.ImageGenerationObjectV4ImageToImage? 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.ImageGenerationObjectV4ImageToImage), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ImageGenerationObjectV4ImageToImage; + } + + /// + /// 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.ImageGenerationObjectV4ImageToImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4ImageToImage.g.cs new file mode 100644 index 0000000..8817a38 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4ImageToImage.g.cs @@ -0,0 +1,104 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"seed":12345,"prompt":"prompt","resolution":"1024x1024","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true} + /// + public sealed partial class ImageGenerationObjectV4ImageToImage + { + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + ///
+ /// https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + ///
+ /// 1024x1024 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4ImageToImageJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.ResolutionV4ImageToImage Resolution { get; set; } + + /// + /// Whether this request passes safety checks. If false, the url field will be empty. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_image_safe")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool IsImageSafe { get; set; } + + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + ///
+ /// 12345 + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Seed { 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. + /// + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + /// + /// + /// Whether this request passes safety checks. If false, the url field will be empty. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageGenerationObjectV4ImageToImage( + string prompt, + global::Ideogram.ResolutionV4ImageToImage resolution, + bool isImageSafe, + int seed, + string? url) + { + this.Url = url; + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Resolution = resolution; + this.IsImageSafe = isImageSafe; + this.Seed = seed; + } + + /// + /// Initializes a new instance of the class. + /// + public ImageGenerationObjectV4ImageToImage() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4Layout.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4Layout.Json.g.cs new file mode 100644 index 0000000..d7dad68 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4Layout.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ImageGenerationObjectV4Layout + { + /// + /// 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.ImageGenerationObjectV4Layout? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ImageGenerationObjectV4Layout), + jsonSerializerContext) as global::Ideogram.ImageGenerationObjectV4Layout; + } + + /// + /// 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.ImageGenerationObjectV4Layout? 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.ImageGenerationObjectV4Layout), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ImageGenerationObjectV4Layout; + } + + /// + /// 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.ImageGenerationObjectV4Layout.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4Layout.g.cs new file mode 100644 index 0000000..c563f8a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationObjectV4Layout.g.cs @@ -0,0 +1,104 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class ImageGenerationObjectV4Layout + { + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + ///
+ /// https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Prompt { get; set; } + + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + ///
+ /// 1024x1024 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4LayoutJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.ResolutionV4Layout Resolution { get; set; } + + /// + /// Whether this request passes safety checks. If false, the url field will be empty. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_image_safe")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool IsImageSafe { get; set; } + + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + ///
+ /// 12345 + [global::System.Text.Json.Serialization.JsonPropertyName("seed")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Seed { 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. + /// + /// + /// The prompt used for the generation. This may be different from the original prompt. + /// + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + /// + /// + /// Whether this request passes safety checks. If false, the url field will be empty. + /// + /// + /// Random seed. Set for reproducible generation.
+ /// Example: 12345 + /// + /// + /// The direct link to the image generated.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageGenerationObjectV4Layout( + string prompt, + global::Ideogram.ResolutionV4Layout resolution, + bool isImageSafe, + int seed, + string? url) + { + this.Url = url; + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Resolution = resolution; + this.IsImageSafe = isImageSafe; + this.Seed = seed; + } + + /// + /// Initializes a new instance of the class. + /// + public ImageGenerationObjectV4Layout() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV3.g.cs index fdc1138..1234e29 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV3.g.cs @@ -56,5 +56,6 @@ public ImageGenerationResponseV3( public ImageGenerationResponseV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4.g.cs index 337e123..9c79b49 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4.g.cs @@ -6,10 +6,17 @@ namespace Ideogram /// /// The response which contains information about the generated image, including the download link.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it.
- /// Example: {"data":[{"seed":12345,"prompt":"prompt","resolution":"1280x800","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true},{"seed":12345,"prompt":"prompt","resolution":"1280x800","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true}],"created":"2000-01-23T04:56:07\u002B00:00"} + /// Example: {"data":[{"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true},{"seed":12345,"prompt":"prompt","resolution":"2048x2048","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true}],"created":"2000-01-23T04:56:07\u002B00:00","response_type":"url"} ///
public sealed partial class ImageGenerationResponseV4 { + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ResponseTypeJsonConverter))] + public global::Ideogram.ImageGenerationResponseV4ResponseType? ResponseType { get; set; } + /// /// The time the request was created. /// @@ -39,13 +46,18 @@ public sealed partial class ImageGenerationResponseV4 /// /// A list of ImageObjects that contain the generated image(s). /// + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public ImageGenerationResponseV4( global::System.DateTime created, - global::System.Collections.Generic.IList data) + global::System.Collections.Generic.IList data, + global::Ideogram.ImageGenerationResponseV4ResponseType? responseType) { + this.ResponseType = responseType; this.Created = created; this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); } @@ -56,5 +68,6 @@ public ImageGenerationResponseV4( public ImageGenerationResponseV4() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImage.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImage.Json.g.cs new file mode 100644 index 0000000..38ff5b7 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImage.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ImageGenerationResponseV4ImageToImage + { + /// + /// 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.ImageGenerationResponseV4ImageToImage? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ImageGenerationResponseV4ImageToImage), + jsonSerializerContext) as global::Ideogram.ImageGenerationResponseV4ImageToImage; + } + + /// + /// 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.ImageGenerationResponseV4ImageToImage? 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.ImageGenerationResponseV4ImageToImage), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ImageGenerationResponseV4ImageToImage; + } + + /// + /// 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.ImageGenerationResponseV4ImageToImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImage.g.cs new file mode 100644 index 0000000..17eaef4 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImage.g.cs @@ -0,0 +1,73 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The response which contains information about the generated image-to-image output, including the download link.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it.
+ /// Example: {"data":[{"seed":12345,"prompt":"prompt","resolution":"1024x1024","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true},{"seed":12345,"prompt":"prompt","resolution":"1024x1024","url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true}],"created":"2000-01-23T04:56:07\u002B00:00","response_type":"url"} + ///
+ public sealed partial class ImageGenerationResponseV4ImageToImage + { + /// + /// Always "url" for this shape. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4ImageToImageResponseTypeJsonConverter))] + public global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType? ResponseType { get; set; } + + /// + /// The time the request was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime Created { get; set; } + + /// + /// A list of ImageObjects that contain the generated image(s). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Data { 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. + /// + /// + /// The time the request was created. + /// + /// + /// A list of ImageObjects that contain the generated image(s). + /// + /// + /// Always "url" for this shape. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageGenerationResponseV4ImageToImage( + global::System.DateTime created, + global::System.Collections.Generic.IList data, + global::Ideogram.ImageGenerationResponseV4ImageToImageResponseType? responseType) + { + this.ResponseType = responseType; + this.Created = created; + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + } + + /// + /// Initializes a new instance of the class. + /// + public ImageGenerationResponseV4ImageToImage() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImageResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImageResponseType.g.cs new file mode 100644 index 0000000..8b4936f --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ImageToImageResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Always "url" for this shape. + /// + public enum ImageGenerationResponseV4ImageToImageResponseType + { + /// + /// + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ImageGenerationResponseV4ImageToImageResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ImageGenerationResponseV4ImageToImageResponseType value) + { + return value switch + { + ImageGenerationResponseV4ImageToImageResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ImageGenerationResponseV4ImageToImageResponseType? ToEnum(string value) + { + return value switch + { + "url" => ImageGenerationResponseV4ImageToImageResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4Layout.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4Layout.Json.g.cs new file mode 100644 index 0000000..296179a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4Layout.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ImageGenerationResponseV4Layout + { + /// + /// 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.ImageGenerationResponseV4Layout? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ImageGenerationResponseV4Layout), + jsonSerializerContext) as global::Ideogram.ImageGenerationResponseV4Layout; + } + + /// + /// 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.ImageGenerationResponseV4Layout? 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.ImageGenerationResponseV4Layout), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ImageGenerationResponseV4Layout; + } + + /// + /// 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.ImageGenerationResponseV4Layout.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4Layout.g.cs new file mode 100644 index 0000000..61cebea --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4Layout.g.cs @@ -0,0 +1,72 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The response which contains information about the generated layout-to-image output, including the download link.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+ public sealed partial class ImageGenerationResponseV4Layout + { + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ImageGenerationResponseV4LayoutResponseTypeJsonConverter))] + public global::Ideogram.ImageGenerationResponseV4LayoutResponseType? ResponseType { get; set; } + + /// + /// The time the request was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime Created { get; set; } + + /// + /// A list of ImageObjects that contain the generated image(s). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Data { 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. + /// + /// + /// The time the request was created. + /// + /// + /// A list of ImageObjects that contain the generated image(s). + /// + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageGenerationResponseV4Layout( + global::System.DateTime created, + global::System.Collections.Generic.IList data, + global::Ideogram.ImageGenerationResponseV4LayoutResponseType? responseType) + { + this.ResponseType = responseType; + this.Created = created; + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + } + + /// + /// Initializes a new instance of the class. + /// + public ImageGenerationResponseV4Layout() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4LayoutResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4LayoutResponseType.g.cs new file mode 100644 index 0000000..15ded88 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4LayoutResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// + public enum ImageGenerationResponseV4LayoutResponseType + { + /// + /// + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ImageGenerationResponseV4LayoutResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ImageGenerationResponseV4LayoutResponseType value) + { + return value switch + { + ImageGenerationResponseV4LayoutResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ImageGenerationResponseV4LayoutResponseType? ToEnum(string value) + { + return value switch + { + "url" => ImageGenerationResponseV4LayoutResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ResponseType.g.cs new file mode 100644 index 0000000..35a8b1d --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageGenerationResponseV4ResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "url" for this shape. + /// + public enum ImageGenerationResponseV4ResponseType + { + /// + /// + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ImageGenerationResponseV4ResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ImageGenerationResponseV4ResponseType value) + { + return value switch + { + ImageGenerationResponseV4ResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ImageGenerationResponseV4ResponseType? ToEnum(string value) + { + return value switch + { + "url" => ImageGenerationResponseV4ResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageLayerV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageLayerV3.g.cs index 951774c..81545b7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageLayerV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageLayerV3.g.cs @@ -5,7 +5,7 @@ namespace Ideogram { /// /// An image layer (logo, brand asset, icon) for a layered image generation.
- /// Example: {"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2} + /// Example: {"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1} ///
public sealed partial class ImageLayerV3 { @@ -93,5 +93,6 @@ public ImageLayerV3( public ImageLayerV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageObject.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageObject.g.cs index 194018e..25dff73 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageObject.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageObject.g.cs @@ -130,5 +130,6 @@ public ImageObject( public ImageObject() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs index b501b5e..9b54903 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageRequest.g.cs @@ -45,6 +45,12 @@ public sealed partial class ImageRequest [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -128,6 +134,9 @@ public sealed partial class ImageRequest /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -163,6 +172,7 @@ public ImageRequest( global::Ideogram.AspectRatio? aspectRatio, global::Ideogram.ModelEnum? model, global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, global::Ideogram.MagicPromptVersionEnum? magicPromptVersion, int? seed, global::Ideogram.StyleType? styleType, @@ -175,6 +185,7 @@ public ImageRequest( this.AspectRatio = aspectRatio; this.Model = model; this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.MagicPromptVersion = magicPromptVersion; this.Seed = seed; this.StyleType = styleType; @@ -190,5 +201,6 @@ public ImageRequest( public ImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ImageSafetyError.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ImageSafetyError.g.cs index 7d2149d..2943454 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ImageSafetyError.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ImageSafetyError.g.cs @@ -43,5 +43,6 @@ public ImageSafetyError( public ImageSafetyError() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InitialImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InitialImageRequest.g.cs index b9b5737..dbb6fb3 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InitialImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InitialImageRequest.g.cs @@ -45,5 +45,6 @@ public InitialImageRequest( public InitialImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchRequest.g.cs index 2b4bf40..0c04e30 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchRequest.g.cs @@ -5,7 +5,7 @@ namespace Ideogram { /// /// A request for batch magic prompt evalution.
- /// Example: {"user_prompts":["a cat","a dog"],"sampling_request_params":{"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}},"experiment_variant":"MAGIC_PROMPT_NO_TEXT"} + /// Example: {"user_prompts":["a cat","a dog"],"sampling_request_params":{"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}},"experiment_variant":"MAGIC_PROMPT_NO_TEXT"} ///
public sealed partial class InternalBatchRequest { @@ -27,9 +27,9 @@ public sealed partial class InternalBatchRequest public string? ExperimentVariant { get; set; } /// - /// Example: {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// Example: {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} /// - /// {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} [global::System.Text.Json.Serialization.JsonPropertyName("sampling_request_params")] public global::Ideogram.SamplingRequestParams? SamplingRequestParams { get; set; } @@ -51,7 +51,7 @@ public sealed partial class InternalBatchRequest /// Example: MAGIC_PROMPT_NO_TEXT /// /// - /// Example: {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// Example: {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] @@ -72,5 +72,6 @@ public InternalBatchRequest( public InternalBatchRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResponse.g.cs index feffa93..a9f051f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResponse.g.cs @@ -43,5 +43,6 @@ public InternalBatchResponse( public InternalBatchResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponse.g.cs index afd461e..79f5f7b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponse.g.cs @@ -57,5 +57,6 @@ public InternalBatchResultsResponse( public InternalBatchResultsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponseResultsInner.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponseResultsInner.g.cs index 11123a0..8fff229 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponseResultsInner.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalBatchResultsResponseResultsInner.g.cs @@ -57,5 +57,6 @@ public InternalBatchResultsResponseResultsInner( public InternalBatchResultsResponseResultsInner() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObject.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObject.g.cs index be69220..62cb158 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObject.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObject.g.cs @@ -48,5 +48,6 @@ public InternalTestingNestedObject( public InternalTestingNestedObject() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObjectRequiredFields.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObjectRequiredFields.g.cs index 9a96c18..9e870e0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObjectRequiredFields.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingNestedObjectRequiredFields.g.cs @@ -50,5 +50,6 @@ public InternalTestingNestedObjectRequiredFields( public InternalTestingNestedObjectRequiredFields() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingRequest.g.cs index 6f287f2..5ca2535 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InternalTestingRequest.g.cs @@ -166,5 +166,6 @@ public InternalTestingRequest( public InternalTestingRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.cs index abd9526..284d977 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.Invoice.g.cs @@ -147,5 +147,6 @@ public Invoice( public Invoice() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.InvoiceLineItem.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.InvoiceLineItem.g.cs index c9cf6e2..cc066c1 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.InvoiceLineItem.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.InvoiceLineItem.g.cs @@ -101,5 +101,6 @@ public InvoiceLineItem( public InvoiceLineItem() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredAssetTextShadow.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredAssetTextShadow.Json.g.cs new file mode 100644 index 0000000..446e47c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredAssetTextShadow.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class LayeredAssetTextShadow + { + /// + /// 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.LayeredAssetTextShadow? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.LayeredAssetTextShadow), + jsonSerializerContext) as global::Ideogram.LayeredAssetTextShadow; + } + + /// + /// 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.LayeredAssetTextShadow? 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.LayeredAssetTextShadow), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.LayeredAssetTextShadow; + } + + /// + /// 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.LayeredAssetTextShadow.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredAssetTextShadow.g.cs new file mode 100644 index 0000000..d4aca08 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredAssetTextShadow.g.cs @@ -0,0 +1,95 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Single CSS shadow for V4 vector text. Used by text_shadows and box_shadow. offset_x, offset_y, and blur are in px.
+ /// Example: {"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767} + ///
+ public sealed partial class LayeredAssetTextShadow + { + /// + /// Shadow hex color. Accepts both 6-hex (#RRGGBB) and 8-hex
+ /// (#RRGGBBAA) — the layered-design extractor emits alpha-included
+ /// colors for semi-transparent shadows, and stripping alpha would
+ /// lose real visual information. Aligned with the other text-layer
+ /// color fields (stroke/border/gradient) which already accept 6,8. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("color")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Color { get; set; } + + /// + /// Horizontal shadow offset in px.
+ /// Default Value: 0 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("offset_x")] + public float? OffsetX { get; set; } + + /// + /// Vertical shadow offset in px.
+ /// Default Value: 0 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("offset_y")] + public float? OffsetY { get; set; } + + /// + /// Shadow blur radius in px.
+ /// Default Value: 0 + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("blur")] + public float? Blur { 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. + /// + /// + /// Shadow hex color. Accepts both 6-hex (#RRGGBB) and 8-hex
+ /// (#RRGGBBAA) — the layered-design extractor emits alpha-included
+ /// colors for semi-transparent shadows, and stripping alpha would
+ /// lose real visual information. Aligned with the other text-layer
+ /// color fields (stroke/border/gradient) which already accept 6,8. + /// + /// + /// Horizontal shadow offset in px.
+ /// Default Value: 0 + /// + /// + /// Vertical shadow offset in px.
+ /// Default Value: 0 + /// + /// + /// Shadow blur radius in px.
+ /// Default Value: 0 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public LayeredAssetTextShadow( + string color, + float? offsetX, + float? offsetY, + float? blur) + { + this.Color = color ?? throw new global::System.ArgumentNullException(nameof(color)); + this.OffsetX = offsetX; + this.OffsetY = offsetY; + this.Blur = blur; + } + + /// + /// Initializes a new instance of the class. + /// + public LayeredAssetTextShadow() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationObjectV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationObjectV3.g.cs index 764f590..5aae3fc 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationObjectV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationObjectV3.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]}],"image_layers":[{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2},{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2}],"url":"https://openapi-generator.tech","text_html":"text_html"} + /// Example: {"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]}],"image_layers":[{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1},{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1}],"url":"https://openapi-generator.tech","text_html":"text_html"} /// public sealed partial class LayeredImageGenerationObjectV3 { @@ -72,5 +72,6 @@ public LayeredImageGenerationObjectV3( public LayeredImageGenerationObjectV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3.g.cs index 204fbba..79af399 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3.g.cs @@ -6,10 +6,17 @@ namespace Ideogram /// /// The response which contains information about the generated image, including the download link and other text layeres.
/// Images links are available for a limited period of time; if you would like to keep the image, you must download it.
- /// Example: {"data":[{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]}],"image_layers":[{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2},{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2}],"url":"https://openapi-generator.tech","text_html":"text_html"},{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]}],"image_layers":[{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2},{"ref_id":"REF_0","x":7,"width":3,"y":9,"height":2}],"url":"https://openapi-generator.tech","text_html":"text_html"}],"created":"2000-01-23T04:56:07\u002B00:00"} + /// Example: {"data":[{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]}],"image_layers":[{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1},{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1}],"url":"https://openapi-generator.tech","text_html":"text_html"},{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]}],"image_layers":[{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1},{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1}],"url":"https://openapi-generator.tech","text_html":"text_html"}],"created":"2000-01-23T04:56:07\u002B00:00","response_type":"layered"} ///
public sealed partial class LayeredImageGenerationResponseV3 { + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "layered" for this shape; absent on the legacy postGenerateDesignV3 endpoint. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.LayeredImageGenerationResponseV3ResponseTypeJsonConverter))] + public global::Ideogram.LayeredImageGenerationResponseV3ResponseType? ResponseType { get; set; } + /// /// The time the request was created. /// @@ -39,13 +46,18 @@ public sealed partial class LayeredImageGenerationResponseV3 /// /// A list of ImageObjects that contain the generated image(s). /// + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "layered" for this shape; absent on the legacy postGenerateDesignV3 endpoint. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public LayeredImageGenerationResponseV3( global::System.DateTime created, - global::System.Collections.Generic.IList data) + global::System.Collections.Generic.IList data, + global::Ideogram.LayeredImageGenerationResponseV3ResponseType? responseType) { + this.ResponseType = responseType; this.Created = created; this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); } @@ -56,5 +68,6 @@ public LayeredImageGenerationResponseV3( public LayeredImageGenerationResponseV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3ResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3ResponseType.g.cs new file mode 100644 index 0000000..c7101e8 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayeredImageGenerationResponseV3ResponseType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Discriminator for the postGenerateDesignV4 oneOf response. Always "layered" for this shape; absent on the legacy postGenerateDesignV3 endpoint. + /// + public enum LayeredImageGenerationResponseV3ResponseType + { + /// + /// + /// + Layered, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class LayeredImageGenerationResponseV3ResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this LayeredImageGenerationResponseV3ResponseType value) + { + return value switch + { + LayeredImageGenerationResponseV3ResponseType.Layered => "layered", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static LayeredImageGenerationResponseV3ResponseType? ToEnum(string value) + { + return value switch + { + "layered" => LayeredImageGenerationResponseV3ResponseType.Layered, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeDesignRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeDesignRequestV3.g.cs index 9e84e2d..465eb8a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeDesignRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeDesignRequestV3.g.cs @@ -225,5 +225,6 @@ public LayerizeDesignRequestV3( public LayerizeDesignRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextRequest.g.cs index cffe793..a101a7c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextRequest.g.cs @@ -79,5 +79,6 @@ public LayerizeTextRequest( public LayerizeTextRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextResponse.g.cs index 00f718c..194103f 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LayerizeTextResponse.g.cs @@ -82,5 +82,6 @@ public LayerizeTextResponse( public LayerizeTextResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ListDatasetsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ListDatasetsResponse.g.cs index 878562c..6f357f8 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ListDatasetsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ListDatasetsResponse.g.cs @@ -44,5 +44,6 @@ public ListDatasetsResponse( public ListDatasetsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ListModelsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ListModelsResponse.g.cs index bb46ee2..eb2cebe 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ListModelsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ListModelsResponse.g.cs @@ -44,5 +44,6 @@ public ListModelsResponse( public ListModelsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ListOrganizationInvoicesResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ListOrganizationInvoicesResponse.g.cs index c5ac12a..32fad9e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ListOrganizationInvoicesResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ListOrganizationInvoicesResponse.g.cs @@ -44,5 +44,6 @@ public ListOrganizationInvoicesResponse( public ListOrganizationInvoicesResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.LiteOrganizationMember.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.LiteOrganizationMember.g.cs index 40df771..e9cb42d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.LiteOrganizationMember.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.LiteOrganizationMember.g.cs @@ -73,5 +73,6 @@ public LiteOrganizationMember( public LiteOrganizationMember() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequest.g.cs index b1af1fb..25ca7b3 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequest.g.cs @@ -10,13 +10,13 @@ namespace Ideogram public sealed partial class MagicPromptRequest { /// - /// The prompt to enhance with a magic prompt
+ /// The prompt to enhance with a magic prompt. Mutually
+ /// exclusive with `messages`; one of the two must be set.
/// Example: a cat ///
/// a cat [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] - [global::System.Text.Json.Serialization.JsonRequired] - public required string Prompt { get; set; } + public string? Prompt { get; set; } /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
@@ -70,6 +70,91 @@ public sealed partial class MagicPromptRequest [global::System.Text.Json.Serialization.JsonPropertyName("system_prompt")] public string? SystemPrompt { get; set; } + /// + /// Optional target aspect ratio used to condition the generated
+ /// magic prompt's framing. Forwarded to the autoprompt pipeline
+ /// so registry-driven system prompts that interpolate
+ /// `` see the bucket the caller intends. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("aspect_ratio")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.AspectRatioV3JsonConverter))] + public global::Ideogram.AspectRatioV3? AspectRatio { get; set; } + + /// + /// Sampling temperature override. Defaults to the trainer-conditioned
+ /// value when omitted (0.7 for V4_QWEN_3_5_27B). Only honored with
+ /// V4 magic-prompt versions; supplying it with another version
+ /// returns 400. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("temperature")] + public float? Temperature { get; set; } + + /// + /// Nucleus-sampling top_p override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("top_p")] + public float? TopP { get; set; } + + /// + /// Top-k sampling override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("top_k")] + public int? TopK { get; set; } + + /// + /// min_p sampling override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("min_p")] + public float? MinP { get; set; } + + /// + /// Cap on the number of tokens the model may generate. Defaults to
+ /// 4096 (the trainer's reference cap) when omitted. Only honored
+ /// with V4 versions. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("max_tokens")] + public int? MaxTokens { get; set; } + + /// + /// Presence-penalty override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("presence_penalty")] + public float? PresencePenalty { get; set; } + + /// + /// Frequency-penalty override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("frequency_penalty")] + public float? FrequencyPenalty { get; set; } + + /// + /// Repetition-penalty override. Only honored with V4 versions. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("repetition_penalty")] + public float? RepetitionPenalty { get; set; } + + /// + /// Optional override of the LoRA adapter the V4 magic-prompt
+ /// wrapper downloads and runs. Pass a `gs://` URI pointing at a
+ /// checkpoint directory containing `adapter_config.json`. When
+ /// omitted, the wrapper-preloaded production checkpoint is used.
+ /// Honored with the wrapper-routed LoRA versions
+ /// `V4_QWEN_3_5_27B` and `V4_QWEN_3_5_27B_FULL_FINETUNE_LORA`;
+ /// supplying it with `V4_QWEN_3_5_27B_PREFUSED` or
+ /// `V4_QWEN_3_5_27B_FULL_FINETUNE` (which serve fixed weights and
+ /// cannot swap adapters per request) or any other version returns
+ /// 400. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("checkpoint")] + public string? Checkpoint { get; set; } + + /// + /// Pre-formed chat messages forwarded verbatim to V4. Mutually
+ /// exclusive with `prompt`; exactly one must be set. V4 only. + ///
+ [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 /// @@ -79,10 +164,6 @@ public sealed partial class MagicPromptRequest /// /// Initializes a new instance of the class. /// - /// - /// The prompt to enhance with a magic prompt
- /// Example: a cat - /// /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -92,6 +173,11 @@ public sealed partial class MagicPromptRequest /// Default Value: true
/// Example: false /// + /// + /// The prompt to enhance with a magic prompt. Mutually
+ /// exclusive with `messages`; one of the two must be set.
+ /// Example: a cat + /// /// /// The style type to generate with.
/// Default Value: GENERAL
@@ -108,25 +194,98 @@ public sealed partial class MagicPromptRequest /// A system prompt to use for the magic prompt.
/// Example: You are a helpful assistant that generates magic prompts for images. /// + /// + /// Optional target aspect ratio used to condition the generated
+ /// magic prompt's framing. Forwarded to the autoprompt pipeline
+ /// so registry-driven system prompts that interpolate
+ /// `` see the bucket the caller intends. + /// + /// + /// Sampling temperature override. Defaults to the trainer-conditioned
+ /// value when omitted (0.7 for V4_QWEN_3_5_27B). Only honored with
+ /// V4 magic-prompt versions; supplying it with another version
+ /// returns 400. + /// + /// + /// Nucleus-sampling top_p override. Only honored with V4 versions. + /// + /// + /// Top-k sampling override. Only honored with V4 versions. + /// + /// + /// min_p sampling override. Only honored with V4 versions. + /// + /// + /// Cap on the number of tokens the model may generate. Defaults to
+ /// 4096 (the trainer's reference cap) when omitted. Only honored
+ /// with V4 versions. + /// + /// + /// Presence-penalty override. Only honored with V4 versions. + /// + /// + /// Frequency-penalty override. Only honored with V4 versions. + /// + /// + /// Repetition-penalty override. Only honored with V4 versions. + /// + /// + /// Optional override of the LoRA adapter the V4 magic-prompt
+ /// wrapper downloads and runs. Pass a `gs://` URI pointing at a
+ /// checkpoint directory containing `adapter_config.json`. When
+ /// omitted, the wrapper-preloaded production checkpoint is used.
+ /// Honored with the wrapper-routed LoRA versions
+ /// `V4_QWEN_3_5_27B` and `V4_QWEN_3_5_27B_FULL_FINETUNE_LORA`;
+ /// supplying it with `V4_QWEN_3_5_27B_PREFUSED` or
+ /// `V4_QWEN_3_5_27B_FULL_FINETUNE` (which serve fixed weights and
+ /// cannot swap adapters per request) or any other version returns
+ /// 400. + /// + /// + /// Pre-formed chat messages forwarded verbatim to V4. Mutually
+ /// exclusive with `prompt`; exactly one must be set. V4 only. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public MagicPromptRequest( - string prompt, global::Ideogram.MagicPromptVersionEnum magicPromptVersion, bool classifyPromptCategory, + string? prompt, global::Ideogram.StyleTypeV3? styleType, int? seed, global::System.Collections.Generic.IList? characterReferenceImages, - string? systemPrompt) + string? systemPrompt, + global::Ideogram.AspectRatioV3? aspectRatio, + float? temperature, + float? topP, + int? topK, + float? minP, + int? maxTokens, + float? presencePenalty, + float? frequencyPenalty, + float? repetitionPenalty, + string? checkpoint, + global::System.Collections.Generic.IList? messages) { - this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Prompt = prompt; this.MagicPromptVersion = magicPromptVersion; this.ClassifyPromptCategory = classifyPromptCategory; this.StyleType = styleType; this.Seed = seed; this.CharacterReferenceImages = characterReferenceImages; this.SystemPrompt = systemPrompt; + this.AspectRatio = aspectRatio; + this.Temperature = temperature; + this.TopP = topP; + this.TopK = topK; + this.MinP = minP; + this.MaxTokens = maxTokens; + this.PresencePenalty = presencePenalty; + this.FrequencyPenalty = frequencyPenalty; + this.RepetitionPenalty = repetitionPenalty; + this.Checkpoint = checkpoint; + this.Messages = messages; } /// @@ -135,5 +294,6 @@ public MagicPromptRequest( public MagicPromptRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInner.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInner.Json.g.cs new file mode 100644 index 0000000..6946d50 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInner.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class MagicPromptRequestMessagesInner + { + /// + /// 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.MagicPromptRequestMessagesInner? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.MagicPromptRequestMessagesInner), + jsonSerializerContext) as global::Ideogram.MagicPromptRequestMessagesInner; + } + + /// + /// 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.MagicPromptRequestMessagesInner? 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.MagicPromptRequestMessagesInner), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.MagicPromptRequestMessagesInner; + } + + /// + /// 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.MagicPromptRequestMessagesInner.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInner.g.cs new file mode 100644 index 0000000..575d71a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInner.g.cs @@ -0,0 +1,56 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class MagicPromptRequestMessagesInner + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("role")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptRequestMessagesInnerRoleJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.MagicPromptRequestMessagesInnerRole Role { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("content")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Content { 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. + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public MagicPromptRequestMessagesInner( + global::Ideogram.MagicPromptRequestMessagesInnerRole role, + string content) + { + this.Role = role; + this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + } + + /// + /// Initializes a new instance of the class. + /// + public MagicPromptRequestMessagesInner() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInnerRole.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInnerRole.g.cs new file mode 100644 index 0000000..8ce251b --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptRequestMessagesInnerRole.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public enum MagicPromptRequestMessagesInnerRole + { + /// + /// + /// + Assistant, + /// + /// + /// + System, + /// + /// + /// + User, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class MagicPromptRequestMessagesInnerRoleExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this MagicPromptRequestMessagesInnerRole value) + { + return value switch + { + MagicPromptRequestMessagesInnerRole.Assistant => "assistant", + MagicPromptRequestMessagesInnerRole.System => "system", + MagicPromptRequestMessagesInnerRole.User => "user", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static MagicPromptRequestMessagesInnerRole? ToEnum(string value) + { + return value switch + { + "assistant" => MagicPromptRequestMessagesInnerRole.Assistant, + "system" => MagicPromptRequestMessagesInnerRole.System, + "user" => MagicPromptRequestMessagesInnerRole.User, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptResponse.g.cs index 7e4ea19..54f5ec9 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptResponse.g.cs @@ -43,5 +43,6 @@ public MagicPromptResponse( public MagicPromptResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Request.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Request.Json.g.cs new file mode 100644 index 0000000..6d3177e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Request.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class MagicPromptV4Request + { + /// + /// 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.MagicPromptV4Request? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.MagicPromptV4Request), + jsonSerializerContext) as global::Ideogram.MagicPromptV4Request; + } + + /// + /// 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.MagicPromptV4Request? 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.MagicPromptV4Request), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.MagicPromptV4Request; + } + + /// + /// 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.MagicPromptV4Request.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Request.g.cs new file mode 100644 index 0000000..17c4173 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Request.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// A request to generate an Ideogram 4.0 magic prompt.
+ /// Example: {"text_prompt":"a cat","aspect_ratio":"AUTO"} + ///
+ public sealed partial class MagicPromptV4Request + { + /// + /// The natural-language prompt to enhance into an Ideogram 4.0 magic
+ /// prompt. Named `text_prompt` to match the Ideogram 4.0 generate
+ /// request surface.
+ /// Example: a cat + ///
+ /// a cat + [global::System.Text.Json.Serialization.JsonPropertyName("text_prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string TextPrompt { get; set; } + + /// + /// Target aspect ratio. Defaults to `AUTO`, which lets the model
+ /// select the most suitable ratio and return it in the response. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("aspect_ratio")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.AspectRatioV4JsonConverter))] + public global::Ideogram.AspectRatioV4? AspectRatio { 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. + /// + /// + /// The natural-language prompt to enhance into an Ideogram 4.0 magic
+ /// prompt. Named `text_prompt` to match the Ideogram 4.0 generate
+ /// request surface.
+ /// Example: a cat + /// + /// + /// Target aspect ratio. Defaults to `AUTO`, which lets the model
+ /// select the most suitable ratio and return it in the response. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public MagicPromptV4Request( + string textPrompt, + global::Ideogram.AspectRatioV4? aspectRatio) + { + this.TextPrompt = textPrompt ?? throw new global::System.ArgumentNullException(nameof(textPrompt)); + this.AspectRatio = aspectRatio; + } + + /// + /// Initializes a new instance of the class. + /// + public MagicPromptV4Request() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Response.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Response.Json.g.cs new file mode 100644 index 0000000..b2239f9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Response.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class MagicPromptV4Response + { + /// + /// 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.MagicPromptV4Response? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.MagicPromptV4Response), + jsonSerializerContext) as global::Ideogram.MagicPromptV4Response; + } + + /// + /// 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.MagicPromptV4Response? 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.MagicPromptV4Response), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.MagicPromptV4Response; + } + + /// + /// 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.MagicPromptV4Response.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Response.g.cs new file mode 100644 index 0000000..965cf30 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptV4Response.g.cs @@ -0,0 +1,69 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The response containing the generated Ideogram 4.0 magic prompt.
+ /// Example: {"json_prompt":{"high_level_description":"A photorealistic ginger cat perched on a vintage wooden chair by a sunlit window.","style_description":{"aesthetics":"warm, cozy, nostalgic","lighting":"soft natural window light","medium":"photograph"},"compositional_deconstruction":{"background":"A dim room with a bright window casting warm light.","elements":[{"type":"obj","desc":"ginger cat with green eyes sitting upright on a vintage wooden chair"}]}},"aspect_ratio":"1x1"} + ///
+ public sealed partial class MagicPromptV4Response + { + /// + /// The enhanced prompt as an Ideogram 4.0 structured JSON prompt. This
+ /// conforms to the same contract as `json_prompt` on
+ /// `/v1/ideogram-v4/generate`, so it can be passed straight back to
+ /// that endpoint. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("json_prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.V4JsonPrompt JsonPrompt { get; set; } + + /// + /// The resolved aspect ratio. When the request used `AUTO`, this is
+ /// the ratio the model selected; otherwise it echoes the request. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("aspect_ratio")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.AspectRatioV4JsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.AspectRatioV4 AspectRatio { 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. + /// + /// + /// The enhanced prompt as an Ideogram 4.0 structured JSON prompt. This
+ /// conforms to the same contract as `json_prompt` on
+ /// `/v1/ideogram-v4/generate`, so it can be passed straight back to
+ /// that endpoint. + /// + /// + /// The resolved aspect ratio. When the request used `AUTO`, this is
+ /// the ratio the model selected; otherwise it echoes the request. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public MagicPromptV4Response( + global::Ideogram.V4JsonPrompt jsonPrompt, + global::Ideogram.AspectRatioV4 aspectRatio) + { + this.JsonPrompt = jsonPrompt ?? throw new global::System.ArgumentNullException(nameof(jsonPrompt)); + this.AspectRatio = aspectRatio; + } + + /// + /// Initializes a new instance of the class. + /// + public MagicPromptV4Response() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptVersionEnum.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptVersionEnum.g.cs index bc9984b..04e278e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptVersionEnum.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MagicPromptVersionEnum.g.cs @@ -9,6 +9,38 @@ namespace Ideogram ///
public enum MagicPromptVersionEnum { + /// + /// + /// + V4Qwen3527b, + /// + /// + /// + V4Qwen3527bExperimental, + /// + /// + /// + V4Qwen3527bExperimentalNonnas2p5k, + /// + /// + /// + V4Qwen3527bExperimentalNonnas5k, + /// + /// + /// + V4Qwen3527bExperimentalQ362p5k, + /// + /// + /// + V4Qwen3527bFullFinetune, + /// + /// + /// + V4Qwen3527bFullFinetuneLora, + /// + /// + /// + V4Qwen3527bPrefused, /// /// /// @@ -59,6 +91,14 @@ public static string ToValueString(this MagicPromptVersionEnum value) { return value switch { + MagicPromptVersionEnum.V4Qwen3527b => "V4_QWEN_3_5_27B", + MagicPromptVersionEnum.V4Qwen3527bExperimental => "V4_QWEN_3_5_27B_EXPERIMENTAL", + MagicPromptVersionEnum.V4Qwen3527bExperimentalNonnas2p5k => "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_2P5K", + MagicPromptVersionEnum.V4Qwen3527bExperimentalNonnas5k => "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_5K", + MagicPromptVersionEnum.V4Qwen3527bExperimentalQ362p5k => "V4_QWEN_3_5_27B_EXPERIMENTAL_Q36_2P5K", + MagicPromptVersionEnum.V4Qwen3527bFullFinetune => "V4_QWEN_3_5_27B_FULL_FINETUNE", + MagicPromptVersionEnum.V4Qwen3527bFullFinetuneLora => "V4_QWEN_3_5_27B_FULL_FINETUNE_LORA", + MagicPromptVersionEnum.V4Qwen3527bPrefused => "V4_QWEN_3_5_27B_PREFUSED", MagicPromptVersionEnum.V0 => "V_0", MagicPromptVersionEnum.V01 => "V_0_1", MagicPromptVersionEnum.V02 => "V_0_2", @@ -78,6 +118,14 @@ public static string ToValueString(this MagicPromptVersionEnum value) { return value switch { + "V4_QWEN_3_5_27B" => MagicPromptVersionEnum.V4Qwen3527b, + "V4_QWEN_3_5_27B_EXPERIMENTAL" => MagicPromptVersionEnum.V4Qwen3527bExperimental, + "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_2P5K" => MagicPromptVersionEnum.V4Qwen3527bExperimentalNonnas2p5k, + "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_5K" => MagicPromptVersionEnum.V4Qwen3527bExperimentalNonnas5k, + "V4_QWEN_3_5_27B_EXPERIMENTAL_Q36_2P5K" => MagicPromptVersionEnum.V4Qwen3527bExperimentalQ362p5k, + "V4_QWEN_3_5_27B_FULL_FINETUNE" => MagicPromptVersionEnum.V4Qwen3527bFullFinetune, + "V4_QWEN_3_5_27B_FULL_FINETUNE_LORA" => MagicPromptVersionEnum.V4Qwen3527bFullFinetuneLora, + "V4_QWEN_3_5_27B_PREFUSED" => MagicPromptVersionEnum.V4Qwen3527bPrefused, "V_0" => MagicPromptVersionEnum.V0, "V_0_1" => MagicPromptVersionEnum.V01, "V_0_2" => MagicPromptVersionEnum.V02, diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiCreditSummaryResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiCreditSummaryResponse.Json.g.cs new file mode 100644 index 0000000..301b449 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiCreditSummaryResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ManageApiCreditSummaryResponse + { + /// + /// 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.ManageApiCreditSummaryResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ManageApiCreditSummaryResponse), + jsonSerializerContext) as global::Ideogram.ManageApiCreditSummaryResponse; + } + + /// + /// 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.ManageApiCreditSummaryResponse? 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.ManageApiCreditSummaryResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ManageApiCreditSummaryResponse; + } + + /// + /// 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.ManageApiCreditSummaryResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiCreditSummaryResponse.g.cs new file mode 100644 index 0000000..9a4013e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiCreditSummaryResponse.g.cs @@ -0,0 +1,92 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"total_issued":{"amount":1050,"currency_code":"USD"},"total_expired":{"amount":1050,"currency_code":"USD"},"total_consumed":{"amount":1050,"currency_code":"USD"},"credit_grants":[{"effective_at":"effective_at","amount_consumed":{"amount":1050,"currency_code":"USD"},"expires_at":"expires_at","amount_available":{"amount":1050,"currency_code":"USD"},"grant_id":"grant_id","name":"name","amount_issued":{"amount":1050,"currency_code":"USD"}},{"effective_at":"effective_at","amount_consumed":{"amount":1050,"currency_code":"USD"},"expires_at":"expires_at","amount_available":{"amount":1050,"currency_code":"USD"},"grant_id":"grant_id","name":"name","amount_issued":{"amount":1050,"currency_code":"USD"}}]} + /// + public sealed partial class ManageApiCreditSummaryResponse + { + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("total_consumed")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price TotalConsumed { get; set; } + + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("total_expired")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price TotalExpired { get; set; } + + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + ///
+ /// {"amount":1050,"currency_code":"USD"} + [global::System.Text.Json.Serialization.JsonPropertyName("total_issued")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.Price TotalIssued { get; set; } + + /// + /// Per-grant breakdown of the user's credit grants. Empty if Metronome is unavailable. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("credit_grants")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList CreditGrants { 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.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// Represents a price.
+ /// Example: {"amount":1050,"currency_code":"USD"} + /// + /// + /// Per-grant breakdown of the user's credit grants. Empty if Metronome is unavailable. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ManageApiCreditSummaryResponse( + global::Ideogram.Price totalConsumed, + global::Ideogram.Price totalExpired, + global::Ideogram.Price totalIssued, + global::System.Collections.Generic.IList creditGrants) + { + this.TotalConsumed = totalConsumed ?? throw new global::System.ArgumentNullException(nameof(totalConsumed)); + this.TotalExpired = totalExpired ?? throw new global::System.ArgumentNullException(nameof(totalExpired)); + this.TotalIssued = totalIssued ?? throw new global::System.ArgumentNullException(nameof(totalIssued)); + this.CreditGrants = creditGrants ?? throw new global::System.ArgumentNullException(nameof(creditGrants)); + } + + /// + /// Initializes a new instance of the class. + /// + public ManageApiCreditSummaryResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiPaymentResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiPaymentResponse.Json.g.cs new file mode 100644 index 0000000..8b628bb --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiPaymentResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class ManageApiPaymentResponse + { + /// + /// 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.ManageApiPaymentResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.ManageApiPaymentResponse), + jsonSerializerContext) as global::Ideogram.ManageApiPaymentResponse; + } + + /// + /// 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.ManageApiPaymentResponse? 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.ManageApiPaymentResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.ManageApiPaymentResponse; + } + + /// + /// 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.ManageApiPaymentResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiPaymentResponse.g.cs new file mode 100644 index 0000000..8ed7328 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiPaymentResponse.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"client_secret":"client_secret"} + /// + public sealed partial class ManageApiPaymentResponse + { + /// + /// client_secret to be passed to the inline payment Elements on the client. Soft-deprecated — new clients use stripe_payment_setup_url on ManageApiStripeSubscriptionResponse for the hosted Checkout flow. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("client_secret")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string ClientSecret { 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. + /// + /// + /// client_secret to be passed to the inline payment Elements on the client. Soft-deprecated — new clients use stripe_payment_setup_url on ManageApiStripeSubscriptionResponse for the hosted Checkout flow. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ManageApiPaymentResponse( + string clientSecret) + { + this.ClientSecret = clientSecret ?? throw new global::System.ArgumentNullException(nameof(clientSecret)); + } + + /// + /// Initializes a new instance of the class. + /// + public ManageApiPaymentResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiStripeSubscriptionResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiStripeSubscriptionResponse.g.cs index 49bc2a2..e87c47b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiStripeSubscriptionResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiStripeSubscriptionResponse.g.cs @@ -6,16 +6,22 @@ namespace Ideogram { /// - /// Example: {"stripe_subscription_url":"stripe_subscription_url","stripe_billing_url":"stripe_billing_url"} + /// Example: {"stripe_subscription_url":"stripe_subscription_url","stripe_billing_url":"stripe_billing_url","stripe_payment_setup_url":"stripe_payment_setup_url"} /// public sealed partial class ManageApiStripeSubscriptionResponse { /// - /// The URL for the user to checkout the Stripe subscription plan. + /// The URL for the user to checkout the Stripe subscription plan. Soft-deprecated — this is the legacy $0-subscription flow; new clients use stripe_payment_setup_url instead. Removed once no callers reference it. /// [global::System.Text.Json.Serialization.JsonPropertyName("stripe_subscription_url")] public string? StripeSubscriptionUrl { get; set; } + /// + /// The URL for the user to capture a payment method via hosted Stripe Checkout (mode='setup'). No charge happens during this flow; the captured payment method is attached to the org's Stripe Customer via the checkout.session.completed webhook. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("stripe_payment_setup_url")] + public string? StripePaymentSetupUrl { get; set; } + /// /// DEPRECATED. The URL for the user to manage the existing Stripe subscription plan. Get this from ManageApiSubscriptionResponse instead. /// @@ -33,15 +39,20 @@ public sealed partial class ManageApiStripeSubscriptionResponse /// Initializes a new instance of the class. ///
/// - /// The URL for the user to checkout the Stripe subscription plan. + /// The URL for the user to checkout the Stripe subscription plan. Soft-deprecated — this is the legacy $0-subscription flow; new clients use stripe_payment_setup_url instead. Removed once no callers reference it. + /// + /// + /// The URL for the user to capture a payment method via hosted Stripe Checkout (mode='setup'). No charge happens during this flow; the captured payment method is attached to the org's Stripe Customer via the checkout.session.completed webhook. /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public ManageApiStripeSubscriptionResponse( - string? stripeSubscriptionUrl) + string? stripeSubscriptionUrl, + string? stripePaymentSetupUrl) { this.StripeSubscriptionUrl = stripeSubscriptionUrl; + this.StripePaymentSetupUrl = stripePaymentSetupUrl; } /// @@ -50,5 +61,6 @@ public ManageApiStripeSubscriptionResponse( public ManageApiStripeSubscriptionResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiSubscriptionResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiSubscriptionResponse.g.cs index 5b0645c..e5e1dc4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiSubscriptionResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ManageApiSubscriptionResponse.g.cs @@ -120,5 +120,6 @@ public ManageApiSubscriptionResponse( public ManageApiSubscriptionResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.MetronomeLinks.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.MetronomeLinks.g.cs index 6c8c890..db94424 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.MetronomeLinks.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.MetronomeLinks.g.cs @@ -96,5 +96,6 @@ public MetronomeLinks( public MetronomeLinks() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ModelVersion.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ModelVersion.g.cs index 8549411..3e183cb 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ModelVersion.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ModelVersion.g.cs @@ -12,6 +12,8 @@ namespace Ideogram /// - V_3_0: Model 3.0 March 26
/// - V_3_1: Model 3.0 Latest
/// - V_4_0: Model 4.0
+ /// - V_4_D: Model 4.0 Layered Design (vector-text path; gated by the access_to_v4 feature flag)
+ /// - V_4_LAYOUT2IMAGE: Model 4.0 Layout to Image (HTML layout rasterized as IMAGE_TO_IMAGE conditioning; gated by the access_to_v4 feature flag)
/// - AUTO: Automatically select the best model version based on the request.
/// Example: V_0_3 ///
@@ -73,6 +75,14 @@ public enum ModelVersion /// Model 4.0 ///
V40, + /// + /// Model 4.0 Layered Design (vector-text path; gated by the access_to_v4 feature flag) + /// + V4d, + /// + /// Model 4.0 Layout to Image (HTML layout rasterized as IMAGE_TO_IMAGE conditioning; gated by the access_to_v4 feature flag) + /// + V4Layout2image, } /// @@ -101,6 +111,8 @@ public static string ToValueString(this ModelVersion value) ModelVersion.V30 => "V_3_0", ModelVersion.V31 => "V_3_1", ModelVersion.V40 => "V_4_0", + ModelVersion.V4d => "V_4_D", + ModelVersion.V4Layout2image => "V_4_LAYOUT2IMAGE", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -125,6 +137,8 @@ public static string ToValueString(this ModelVersion value) "V_3_0" => ModelVersion.V30, "V_3_1" => ModelVersion.V31, "V_4_0" => ModelVersion.V40, + "V_4_D" => ModelVersion.V4d, + "V_4_LAYOUT2IMAGE" => ModelVersion.V4Layout2image, _ => null, }; } diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMember.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMember.g.cs index 7cf1f3a..46b25b5 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMember.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMember.g.cs @@ -117,5 +117,6 @@ public OrganizationMember( public OrganizationMember() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResponse.g.cs index dc063a7..54b0dd8 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResponse.g.cs @@ -42,5 +42,6 @@ public OrganizationMemberOperationResponse( public OrganizationMemberOperationResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResult.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResult.g.cs index 49360b7..e5a907e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResult.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.OrganizationMemberOperationResult.g.cs @@ -53,5 +53,6 @@ public OrganizationMemberOperationResult( public OrganizationMemberOperationResult() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PatchApiKeyRequest.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PatchApiKeyRequest.Json.g.cs new file mode 100644 index 0000000..2b34577 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PatchApiKeyRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class PatchApiKeyRequest + { + /// + /// 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.PatchApiKeyRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PatchApiKeyRequest), + jsonSerializerContext) as global::Ideogram.PatchApiKeyRequest; + } + + /// + /// 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.PatchApiKeyRequest? 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.PatchApiKeyRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PatchApiKeyRequest; + } + + /// + /// 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.PatchApiKeyRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PatchApiKeyRequest.g.cs new file mode 100644 index 0000000..9960825 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PatchApiKeyRequest.g.cs @@ -0,0 +1,49 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"label":"Live production environment"} + /// + public sealed partial class PatchApiKeyRequest + { + /// + /// New label for the API key. Pass null (or omit) to clear the existing label.
+ /// Example: Live production environment + ///
+ /// Live production environment + [global::System.Text.Json.Serialization.JsonPropertyName("label")] + public string? Label { 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. + /// + /// + /// New label for the API key. Pass null (or omit) to clear the existing label.
+ /// Example: Live production environment + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PatchApiKeyRequest( + string? label) + { + this.Label = label; + } + + /// + /// Initializes a new instance of the class. + /// + public PatchApiKeyRequest() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs index 8db6c29..1c0e216 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsError.g.cs @@ -42,5 +42,6 @@ public PostAddCreditsError( public PostAddCreditsError() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs index 314dc2a..6e2392b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsRequest.g.cs @@ -45,5 +45,6 @@ public PostAddCreditsRequest( public PostAddCreditsRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs index 1ba74ca..c94bbc6 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostAddCreditsResponse.g.cs @@ -45,5 +45,6 @@ public PostAddCreditsResponse( public PostAddCreditsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiKeyResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiKeyResponse.g.cs index 87b8df5..68a527e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiKeyResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiKeyResponse.g.cs @@ -60,5 +60,6 @@ public PostApiKeyResponse( public PostApiKeyResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiReactivateResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiReactivateResponse.g.cs index 9bcfb5d..b2c6416 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiReactivateResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiReactivateResponse.g.cs @@ -43,5 +43,6 @@ public PostApiReactivateResponse( public PostApiReactivateResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionError.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionError.g.cs index 88f73db..d2eaa13 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionError.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionError.g.cs @@ -42,5 +42,6 @@ public PostApiSubscriptionError( public PostApiSubscriptionError() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionRequest.g.cs index a41128f..1e32e2e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionRequest.g.cs @@ -56,5 +56,6 @@ public PostApiSubscriptionRequest( public PostApiSubscriptionRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionResponse.g.cs index 3e84979..c33bce4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiSubscriptionResponse.g.cs @@ -43,5 +43,6 @@ public PostApiSubscriptionResponse( public PostApiSubscriptionResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiTermsRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiTermsRequest.g.cs index ce692b9..ad7b5be 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostApiTermsRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostApiTermsRequest.g.cs @@ -45,5 +45,6 @@ public PostApiTermsRequest( public PostApiTermsRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200Response.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200Response.Json.g.cs new file mode 100644 index 0000000..eed0aa0 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200Response.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public readonly partial struct PostGenerateDesignV4200Response + { + /// + /// 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.PostGenerateDesignV4200Response? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PostGenerateDesignV4200Response), + jsonSerializerContext) as global::Ideogram.PostGenerateDesignV4200Response?; + } + + /// + /// 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.PostGenerateDesignV4200Response? 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.PostGenerateDesignV4200Response), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PostGenerateDesignV4200Response?; + } + + /// + /// 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.PostGenerateDesignV4200Response.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200Response.g.cs new file mode 100644 index 0000000..dbd5b69 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200Response.g.cs @@ -0,0 +1,306 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public readonly partial struct PostGenerateDesignV4200Response : global::System.IEquatable + { + /// + /// + /// + public global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? ResponseType { get; } + + /// + /// The response which contains information about the generated image, including the download link and other text layeres.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it.
+ /// Example: {"data":[{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]}],"image_layers":[{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1},{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1}],"url":"https://openapi-generator.tech","text_html":"text_html"},{"text_containers":[{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]},{"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]}],"image_layers":[{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1},{"ref_id":"REF_0","x":4,"width":1,"y":7,"height":1}],"url":"https://openapi-generator.tech","text_html":"text_html"}],"created":"2000-01-23T04:56:07\u002B00:00","response_type":"layered"} + ///
+#if NET6_0_OR_GREATER + public global::Ideogram.LayeredImageGenerationResponseV3? Layered { get; init; } +#else + public global::Ideogram.LayeredImageGenerationResponseV3? Layered { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Layered))] +#endif + public bool IsLayered => Layered != null; + + /// + /// + /// + public bool TryPickLayered( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.LayeredImageGenerationResponseV3? value) + { + value = Layered; + return IsLayered; + } + + /// + /// + /// + public global::Ideogram.LayeredImageGenerationResponseV3 PickLayered() => IsLayered + ? Layered! + : throw new global::System.InvalidOperationException($"Expected union variant 'Layered' but the value was {ToString()}."); + + /// + /// The response which contains information about the generated layout-to-image output, including the download link.
+ /// Images links are available for a limited period of time; if you would like to keep the image, you must download it. + ///
+#if NET6_0_OR_GREATER + public global::Ideogram.ImageGenerationResponseV4Layout? Url { get; init; } +#else + public global::Ideogram.ImageGenerationResponseV4Layout? Url { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Url))] +#endif + public bool IsUrl => Url != null; + + /// + /// + /// + public bool TryPickUrl( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.ImageGenerationResponseV4Layout? value) + { + value = Url; + return IsUrl; + } + + /// + /// + /// + public global::Ideogram.ImageGenerationResponseV4Layout PickUrl() => IsUrl + ? Url! + : throw new global::System.InvalidOperationException($"Expected union variant 'Url' but the value was {ToString()}."); + /// + /// + /// + public static implicit operator PostGenerateDesignV4200Response(global::Ideogram.LayeredImageGenerationResponseV3 value) => new PostGenerateDesignV4200Response((global::Ideogram.LayeredImageGenerationResponseV3?)value); + + /// + /// + /// + public static implicit operator global::Ideogram.LayeredImageGenerationResponseV3?(PostGenerateDesignV4200Response @this) => @this.Layered; + + /// + /// + /// + public PostGenerateDesignV4200Response(global::Ideogram.LayeredImageGenerationResponseV3? value) + { + Layered = value; + } + + /// + /// + /// + public static PostGenerateDesignV4200Response FromLayered(global::Ideogram.LayeredImageGenerationResponseV3? value) => new PostGenerateDesignV4200Response(value); + + /// + /// + /// + public static implicit operator PostGenerateDesignV4200Response(global::Ideogram.ImageGenerationResponseV4Layout value) => new PostGenerateDesignV4200Response((global::Ideogram.ImageGenerationResponseV4Layout?)value); + + /// + /// + /// + public static implicit operator global::Ideogram.ImageGenerationResponseV4Layout?(PostGenerateDesignV4200Response @this) => @this.Url; + + /// + /// + /// + public PostGenerateDesignV4200Response(global::Ideogram.ImageGenerationResponseV4Layout? value) + { + Url = value; + } + + /// + /// + /// + public static PostGenerateDesignV4200Response FromUrl(global::Ideogram.ImageGenerationResponseV4Layout? value) => new PostGenerateDesignV4200Response(value); + + /// + /// + /// + public PostGenerateDesignV4200Response( + global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? responseType, + global::Ideogram.LayeredImageGenerationResponseV3? layered, + global::Ideogram.ImageGenerationResponseV4Layout? url + ) + { + ResponseType = responseType; + + Layered = layered; + Url = url; + } + + /// + /// + /// + public object? Object => + Url as object ?? + Layered as object + ; + + /// + /// + /// + public override string? ToString() => + Layered?.ToString() ?? + Url?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsLayered && !IsUrl || !IsLayered && IsUrl; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? layered = null, + global::System.Func? url = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsLayered && layered != null) + { + return layered(Layered!); + } + else if (IsUrl && url != null) + { + return url(Url!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? layered = null, + + global::System.Action? url = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsLayered) + { + layered?.Invoke(Layered!); + } + else if (IsUrl) + { + url?.Invoke(Url!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? layered = null, + global::System.Action? url = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsLayered) + { + layered?.Invoke(Layered!); + } + else if (IsUrl) + { + url?.Invoke(Url!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Layered, + typeof(global::Ideogram.LayeredImageGenerationResponseV3), + Url, + typeof(global::Ideogram.ImageGenerationResponseV4Layout), + }; + 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 global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(PostGenerateDesignV4200Response other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Layered, other.Layered) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Url, other.Url) + ; + } + + /// + /// + /// + public static bool operator ==(PostGenerateDesignV4200Response obj1, PostGenerateDesignV4200Response obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(PostGenerateDesignV4200Response obj1, PostGenerateDesignV4200Response obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is PostGenerateDesignV4200Response o && Equals(o); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminator.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminator.Json.g.cs new file mode 100644 index 0000000..677d236 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class PostGenerateDesignV4200ResponseDiscriminator + { + /// + /// 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.PostGenerateDesignV4200ResponseDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator), + jsonSerializerContext) as global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator; + } + + /// + /// 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.PostGenerateDesignV4200ResponseDiscriminator? 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.PostGenerateDesignV4200ResponseDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.PostGenerateDesignV4200ResponseDiscriminator; + } + + /// + /// 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.PostGenerateDesignV4200ResponseDiscriminator.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminator.g.cs new file mode 100644 index 0000000..4f6d267 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminator.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class PostGenerateDesignV4200ResponseDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("response_type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.PostGenerateDesignV4200ResponseDiscriminatorResponseTypeJsonConverter))] + public global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? ResponseType { 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. + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PostGenerateDesignV4200ResponseDiscriminator( + global::Ideogram.PostGenerateDesignV4200ResponseDiscriminatorResponseType? responseType) + { + this.ResponseType = responseType; + } + + /// + /// Initializes a new instance of the class. + /// + public PostGenerateDesignV4200ResponseDiscriminator() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs new file mode 100644 index 0000000..ce554cb --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostGenerateDesignV4200ResponseDiscriminatorResponseType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public enum PostGenerateDesignV4200ResponseDiscriminatorResponseType + { + /// + /// + /// + Layered, + /// + /// + /// + Url, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class PostGenerateDesignV4200ResponseDiscriminatorResponseTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this PostGenerateDesignV4200ResponseDiscriminatorResponseType value) + { + return value switch + { + PostGenerateDesignV4200ResponseDiscriminatorResponseType.Layered => "layered", + PostGenerateDesignV4200ResponseDiscriminatorResponseType.Url => "url", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static PostGenerateDesignV4200ResponseDiscriminatorResponseType? ToEnum(string value) + { + return value switch + { + "layered" => PostGenerateDesignV4200ResponseDiscriminatorResponseType.Layered, + "url" => PostGenerateDesignV4200ResponseDiscriminatorResponseType.Url, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PostInternalTesting200Response.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PostInternalTesting200Response.g.cs index 832dddb..923f867 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PostInternalTesting200Response.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PostInternalTesting200Response.g.cs @@ -39,5 +39,6 @@ public PostInternalTesting200Response( public PostInternalTesting200Response() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.Price.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.Price.g.cs index 82c4903..7daecb7 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.Price.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.Price.g.cs @@ -61,5 +61,6 @@ public Price( public Price() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.PromoteOrganizationMembersRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.PromoteOrganizationMembersRequest.g.cs index 34dd709..aabdb5b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.PromoteOrganizationMembersRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.PromoteOrganizationMembersRequest.g.cs @@ -44,5 +44,6 @@ public PromoteOrganizationMembersRequest( public PromoteOrganizationMembersRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettings.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettings.g.cs index c55cb79..f8d51c8 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettings.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettings.g.cs @@ -61,5 +61,6 @@ public RechargeSettings( public RechargeSettings() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettingsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettingsResponse.g.cs index 91211b7..5708278 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettingsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RechargeSettingsResponse.g.cs @@ -42,5 +42,6 @@ public RechargeSettingsResponse( public RechargeSettingsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RedactedApiKey.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RedactedApiKey.g.cs index 3ac9f81..b8695c5 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RedactedApiKey.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RedactedApiKey.g.cs @@ -73,5 +73,6 @@ public RedactedApiKey( public RedactedApiKey() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequest.g.cs index a18d8b8..c199e48 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequest.g.cs @@ -131,5 +131,6 @@ public ReframeImageRequest( public ReframeImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequestV3.g.cs index 2991eeb..5dd6d5c 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ReframeImageRequestV3.g.cs @@ -163,5 +163,6 @@ public ReframeImageRequestV3( public ReframeImageRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequest.g.cs index e838d16..e1cefc4 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequest.g.cs @@ -69,5 +69,6 @@ public RemixImageRequest( public RemixImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV3.g.cs index 2782121..0af9bf6 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV3.g.cs @@ -80,6 +80,12 @@ public sealed partial class RemixImageRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -199,6 +205,9 @@ public sealed partial class RemixImageRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// Description of what to exclude from an image. Descriptions in the prompt take precedence
/// to descriptions in the negative prompt.
@@ -251,6 +260,7 @@ public RemixImageRequestV3( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.RenderingSpeed? renderingSpeed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, string? negativePrompt, int? numImages, global::Ideogram.ColorPaletteWithPresetNameOrMembers? colorPalette, @@ -271,6 +281,7 @@ public RemixImageRequestV3( this.AspectRatio = aspectRatio; this.RenderingSpeed = renderingSpeed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NegativePrompt = negativePrompt; this.NumImages = numImages; this.ColorPalette = colorPalette; @@ -289,5 +300,6 @@ public RemixImageRequestV3( public RemixImageRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV4.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV4.Json.g.cs new file mode 100644 index 0000000..6e03aa1 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV4.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class RemixImageRequestV4 + { + /// + /// 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.RemixImageRequestV4? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.RemixImageRequestV4), + jsonSerializerContext) as global::Ideogram.RemixImageRequestV4; + } + + /// + /// 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.RemixImageRequestV4? 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.RemixImageRequestV4), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.RemixImageRequestV4; + } + + /// + /// 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.RemixImageRequestV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV4.g.cs new file mode 100644 index 0000000..c63951e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemixImageRequestV4.g.cs @@ -0,0 +1,130 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class RemixImageRequestV4 + { + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Image { get; set; } + + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("imagename")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Imagename { get; set; } + + /// + /// The text prompt that guides the remix. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text_prompt")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string TextPrompt { get; set; } + + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("image_weight")] + public int? ImageWeight { get; set; } + + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + ///
+ /// 2048x2048 + [global::System.Text.Json.Serialization.JsonPropertyName("resolution")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.ResolutionV4JsonConverter))] + public global::Ideogram.ResolutionV4? Resolution { get; set; } + + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("rendering_speed")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.RenderingSpeedJsonConverter))] + public global::Ideogram.RenderingSpeed? RenderingSpeed { get; set; } + + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("enable_copyright_detection")] + public bool? EnableCopyrightDetection { 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. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported. + /// + /// + /// The text prompt that guides the remix. + /// + /// + /// Optional. How strongly the output should resemble the input image. Higher values keep
+ /// the input image's structure; lower values allow the prompt to drive the output more.
+ /// When omitted, the weight is chosen automatically from the edit instruction; supplying
+ /// a value overrides that automatic choice. + /// + /// + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 + /// + /// + /// The rendering speed to use.
+ /// Default Value: DEFAULT + /// + /// + /// Optional. Opt this request into post-generation copyright detection (Hive likeness + logo
+ /// checks). See GenerateImageRequestV3 for details. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public RemixImageRequestV4( + byte[] image, + string imagename, + string textPrompt, + int? imageWeight, + global::Ideogram.ResolutionV4? resolution, + global::Ideogram.RenderingSpeed? renderingSpeed, + bool? enableCopyrightDetection) + { + this.Image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); + this.TextPrompt = textPrompt ?? throw new global::System.ArgumentNullException(nameof(textPrompt)); + this.ImageWeight = imageWeight; + this.Resolution = resolution; + this.RenderingSpeed = renderingSpeed; + this.EnableCopyrightDetection = enableCopyrightDetection; + } + + /// + /// Initializes a new instance of the class. + /// + public RemixImageRequestV4() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundImageObject.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundImageObject.Json.g.cs new file mode 100644 index 0000000..fa4257c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundImageObject.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class RemoveBackgroundImageObject + { + /// + /// 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.RemoveBackgroundImageObject? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.RemoveBackgroundImageObject), + jsonSerializerContext) as global::Ideogram.RemoveBackgroundImageObject; + } + + /// + /// 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.RemoveBackgroundImageObject? 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.RemoveBackgroundImageObject), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.RemoveBackgroundImageObject; + } + + /// + /// 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.RemoveBackgroundImageObject.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundImageObject.g.cs new file mode 100644 index 0000000..4e0c4ed --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundImageObject.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class RemoveBackgroundImageObject + { + /// + /// The direct link to the foreground image. Empty when the image fails safety checks.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + ///
+ /// https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Whether the foreground image passes safety checks. If false, the url field will be empty. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("is_image_safe")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool IsImageSafe { 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. + /// + /// + /// Whether the foreground image passes safety checks. If false, the url field will be empty. + /// + /// + /// The direct link to the foreground image. Empty when the image fails safety checks.
+ /// Example: https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public RemoveBackgroundImageObject( + bool isImageSafe, + string? url) + { + this.Url = url; + this.IsImageSafe = isImageSafe; + } + + /// + /// Initializes a new instance of the class. + /// + public RemoveBackgroundImageObject() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundRequest.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundRequest.Json.g.cs new file mode 100644 index 0000000..e9176a9 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class RemoveBackgroundRequest + { + /// + /// 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.RemoveBackgroundRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.RemoveBackgroundRequest), + jsonSerializerContext) as global::Ideogram.RemoveBackgroundRequest; + } + + /// + /// 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.RemoveBackgroundRequest? 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.RemoveBackgroundRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.RemoveBackgroundRequest; + } + + /// + /// 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.RemoveBackgroundRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundRequest.g.cs new file mode 100644 index 0000000..acca074 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundRequest.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class RemoveBackgroundRequest + { + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + [global::System.Text.Json.Serialization.JsonRequired] + public required byte[] Image { get; set; } + + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("imagename")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Imagename { 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. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public RemoveBackgroundRequest( + byte[] image, + string imagename) + { + this.Image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); + } + + /// + /// Initializes a new instance of the class. + /// + public RemoveBackgroundRequest() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundResponse.Json.g.cs new file mode 100644 index 0000000..8449096 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class RemoveBackgroundResponse + { + /// + /// 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.RemoveBackgroundResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.RemoveBackgroundResponse), + jsonSerializerContext) as global::Ideogram.RemoveBackgroundResponse; + } + + /// + /// 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.RemoveBackgroundResponse? 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.RemoveBackgroundResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.RemoveBackgroundResponse; + } + + /// + /// 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.RemoveBackgroundResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundResponse.g.cs new file mode 100644 index 0000000..7cd4eca --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveBackgroundResponse.g.cs @@ -0,0 +1,61 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The response containing the foreground image with the background removed.
+ /// Image links are available for a limited period of time; if you would like to keep the image, you must download it.
+ /// Example: {"created":"2000-01-23T04:56:07\u002B00:00","data":[{"url":"https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804\u0026sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89","is_image_safe":true}]} + ///
+ public sealed partial class RemoveBackgroundResponse + { + /// + /// The time the request was created. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime Created { get; set; } + + /// + /// A list containing the single foreground image. The endpoint always returns exactly one entry. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("data")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Data { 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. + /// + /// + /// The time the request was created. + /// + /// + /// A list containing the single foreground image. The endpoint always returns exactly one entry. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public RemoveBackgroundResponse( + global::System.DateTime created, + global::System.Collections.Generic.IList data) + { + this.Created = created; + this.Data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + } + + /// + /// Initializes a new instance of the class. + /// + public RemoveBackgroundResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.RemoveOrganizationMembersRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveOrganizationMembersRequest.g.cs index 29ba4a4..ec436f0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.RemoveOrganizationMembersRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.RemoveOrganizationMembersRequest.g.cs @@ -44,5 +44,6 @@ public RemoveOrganizationMembersRequest( public RemoveOrganizationMembersRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ReplaceBackgroundRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ReplaceBackgroundRequestV3.g.cs index ef09ffb..4a656b0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ReplaceBackgroundRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ReplaceBackgroundRequestV3.g.cs @@ -40,6 +40,12 @@ public sealed partial class ReplaceBackgroundRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The number of images to generate.
/// Default Value: 1 @@ -116,6 +122,9 @@ public sealed partial class ReplaceBackgroundRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -150,6 +159,7 @@ public ReplaceBackgroundRequestV3( string imagename, string prompt, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, int? numImages, int? seed, global::Ideogram.RenderingSpeed? renderingSpeed, @@ -162,6 +172,7 @@ public ReplaceBackgroundRequestV3( this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NumImages = numImages; this.Seed = seed; this.RenderingSpeed = renderingSpeed; @@ -177,5 +188,6 @@ public ReplaceBackgroundRequestV3( public ReplaceBackgroundRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4.g.cs index 24dd3a4..a75c994 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4.g.cs @@ -4,291 +4,103 @@ namespace Ideogram { /// - /// The resolutions supported for Ideogram 4.0.
- /// Example: 1280x800 + /// The 2K resolutions supported for Ideogram 4.0 image generation.
+ /// Example: 2048x2048 ///
public enum ResolutionV4 { /// /// /// - x1024x1024, + x1024x3072, /// /// /// - x1024x832, + x1152x2944, /// /// /// - x1024x896, + x1248x3328, /// /// /// - x1024x960, + x1280x3072, /// /// /// - x1088x768, + x1296x3168, /// /// /// - x1088x832, + x1440x2560, /// /// /// - x1088x896, + x1440x2880, /// /// /// - x1088x960, + x1600x2560, /// /// /// - x1120x896, + x1664x2496, /// /// /// - x1152x704, + x1728x2304, /// /// /// - x1152x832, + x1792x2240, /// /// /// - x1152x864, + x2048x2048, /// /// /// - x1152x896, + x2240x1792, /// /// /// - x1216x704, + x2304x1728, /// /// /// - x1216x768, + x2496x1664, /// /// /// - x1216x832, + x2560x1440, /// /// /// - x1248x832, + x2560x1600, /// /// /// - x1280x704, + x2880x1440, /// /// /// - x1280x768, + x2944x1152, /// /// /// - x1280x800, + x3072x1024, /// /// /// - x1312x736, + x3072x1280, /// /// /// - x1344x640, + x3168x1296, /// /// /// - x1344x704, - /// - /// - /// - x1344x768, - /// - /// - /// - x1408x576, - /// - /// - /// - x1408x640, - /// - /// - /// - x1408x704, - /// - /// - /// - x1472x576, - /// - /// - /// - x1472x640, - /// - /// - /// - x1472x704, - /// - /// - /// - x1536x512, - /// - /// - /// - x1536x576, - /// - /// - /// - x1536x640, - /// - /// - /// - x512x1536, - /// - /// - /// - x512x512, - /// - /// - /// - x576x1408, - /// - /// - /// - x576x1472, - /// - /// - /// - x576x1536, - /// - /// - /// - x640x1344, - /// - /// - /// - x640x1408, - /// - /// - /// - x640x1472, - /// - /// - /// - x640x1536, - /// - /// - /// - x704x1152, - /// - /// - /// - x704x1216, - /// - /// - /// - x704x1280, - /// - /// - /// - x704x1344, - /// - /// - /// - x704x1408, - /// - /// - /// - x704x1472, - /// - /// - /// - x736x1312, - /// - /// - /// - x768x1088, - /// - /// - /// - x768x1216, - /// - /// - /// - x768x1280, - /// - /// - /// - x768x1344, - /// - /// - /// - x800x1280, - /// - /// - /// - x832x1024, - /// - /// - /// - x832x1088, - /// - /// - /// - x832x1152, - /// - /// - /// - x832x1216, - /// - /// - /// - x832x1248, - /// - /// - /// - x832x960, - /// - /// - /// - x864x1152, - /// - /// - /// - x896x1024, - /// - /// - /// - x896x1088, - /// - /// - /// - x896x1120, - /// - /// - /// - x896x1152, - /// - /// - /// - x896x960, - /// - /// - /// - x960x1024, - /// - /// - /// - x960x1088, - /// - /// - /// - x960x832, - /// - /// - /// - x960x896, + x3328x1248, } /// @@ -303,76 +115,29 @@ public static string ToValueString(this ResolutionV4 value) { return value switch { - ResolutionV4.x1024x1024 => "1024x1024", - ResolutionV4.x1024x832 => "1024x832", - ResolutionV4.x1024x896 => "1024x896", - ResolutionV4.x1024x960 => "1024x960", - ResolutionV4.x1088x768 => "1088x768", - ResolutionV4.x1088x832 => "1088x832", - ResolutionV4.x1088x896 => "1088x896", - ResolutionV4.x1088x960 => "1088x960", - ResolutionV4.x1120x896 => "1120x896", - ResolutionV4.x1152x704 => "1152x704", - ResolutionV4.x1152x832 => "1152x832", - ResolutionV4.x1152x864 => "1152x864", - ResolutionV4.x1152x896 => "1152x896", - ResolutionV4.x1216x704 => "1216x704", - ResolutionV4.x1216x768 => "1216x768", - ResolutionV4.x1216x832 => "1216x832", - ResolutionV4.x1248x832 => "1248x832", - ResolutionV4.x1280x704 => "1280x704", - ResolutionV4.x1280x768 => "1280x768", - ResolutionV4.x1280x800 => "1280x800", - ResolutionV4.x1312x736 => "1312x736", - ResolutionV4.x1344x640 => "1344x640", - ResolutionV4.x1344x704 => "1344x704", - ResolutionV4.x1344x768 => "1344x768", - ResolutionV4.x1408x576 => "1408x576", - ResolutionV4.x1408x640 => "1408x640", - ResolutionV4.x1408x704 => "1408x704", - ResolutionV4.x1472x576 => "1472x576", - ResolutionV4.x1472x640 => "1472x640", - ResolutionV4.x1472x704 => "1472x704", - ResolutionV4.x1536x512 => "1536x512", - ResolutionV4.x1536x576 => "1536x576", - ResolutionV4.x1536x640 => "1536x640", - ResolutionV4.x512x1536 => "512x1536", - ResolutionV4.x512x512 => "512x512", - ResolutionV4.x576x1408 => "576x1408", - ResolutionV4.x576x1472 => "576x1472", - ResolutionV4.x576x1536 => "576x1536", - ResolutionV4.x640x1344 => "640x1344", - ResolutionV4.x640x1408 => "640x1408", - ResolutionV4.x640x1472 => "640x1472", - ResolutionV4.x640x1536 => "640x1536", - ResolutionV4.x704x1152 => "704x1152", - ResolutionV4.x704x1216 => "704x1216", - ResolutionV4.x704x1280 => "704x1280", - ResolutionV4.x704x1344 => "704x1344", - ResolutionV4.x704x1408 => "704x1408", - ResolutionV4.x704x1472 => "704x1472", - ResolutionV4.x736x1312 => "736x1312", - ResolutionV4.x768x1088 => "768x1088", - ResolutionV4.x768x1216 => "768x1216", - ResolutionV4.x768x1280 => "768x1280", - ResolutionV4.x768x1344 => "768x1344", - ResolutionV4.x800x1280 => "800x1280", - ResolutionV4.x832x1024 => "832x1024", - ResolutionV4.x832x1088 => "832x1088", - ResolutionV4.x832x1152 => "832x1152", - ResolutionV4.x832x1216 => "832x1216", - ResolutionV4.x832x1248 => "832x1248", - ResolutionV4.x832x960 => "832x960", - ResolutionV4.x864x1152 => "864x1152", - ResolutionV4.x896x1024 => "896x1024", - ResolutionV4.x896x1088 => "896x1088", - ResolutionV4.x896x1120 => "896x1120", - ResolutionV4.x896x1152 => "896x1152", - ResolutionV4.x896x960 => "896x960", - ResolutionV4.x960x1024 => "960x1024", - ResolutionV4.x960x1088 => "960x1088", - ResolutionV4.x960x832 => "960x832", - ResolutionV4.x960x896 => "960x896", + ResolutionV4.x1024x3072 => "1024x3072", + ResolutionV4.x1152x2944 => "1152x2944", + ResolutionV4.x1248x3328 => "1248x3328", + ResolutionV4.x1280x3072 => "1280x3072", + ResolutionV4.x1296x3168 => "1296x3168", + ResolutionV4.x1440x2560 => "1440x2560", + ResolutionV4.x1440x2880 => "1440x2880", + ResolutionV4.x1600x2560 => "1600x2560", + ResolutionV4.x1664x2496 => "1664x2496", + ResolutionV4.x1728x2304 => "1728x2304", + ResolutionV4.x1792x2240 => "1792x2240", + ResolutionV4.x2048x2048 => "2048x2048", + ResolutionV4.x2240x1792 => "2240x1792", + ResolutionV4.x2304x1728 => "2304x1728", + ResolutionV4.x2496x1664 => "2496x1664", + ResolutionV4.x2560x1440 => "2560x1440", + ResolutionV4.x2560x1600 => "2560x1600", + ResolutionV4.x2880x1440 => "2880x1440", + ResolutionV4.x2944x1152 => "2944x1152", + ResolutionV4.x3072x1024 => "3072x1024", + ResolutionV4.x3072x1280 => "3072x1280", + ResolutionV4.x3168x1296 => "3168x1296", + ResolutionV4.x3328x1248 => "3328x1248", _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -383,76 +148,29 @@ public static string ToValueString(this ResolutionV4 value) { return value switch { - "1024x1024" => ResolutionV4.x1024x1024, - "1024x832" => ResolutionV4.x1024x832, - "1024x896" => ResolutionV4.x1024x896, - "1024x960" => ResolutionV4.x1024x960, - "1088x768" => ResolutionV4.x1088x768, - "1088x832" => ResolutionV4.x1088x832, - "1088x896" => ResolutionV4.x1088x896, - "1088x960" => ResolutionV4.x1088x960, - "1120x896" => ResolutionV4.x1120x896, - "1152x704" => ResolutionV4.x1152x704, - "1152x832" => ResolutionV4.x1152x832, - "1152x864" => ResolutionV4.x1152x864, - "1152x896" => ResolutionV4.x1152x896, - "1216x704" => ResolutionV4.x1216x704, - "1216x768" => ResolutionV4.x1216x768, - "1216x832" => ResolutionV4.x1216x832, - "1248x832" => ResolutionV4.x1248x832, - "1280x704" => ResolutionV4.x1280x704, - "1280x768" => ResolutionV4.x1280x768, - "1280x800" => ResolutionV4.x1280x800, - "1312x736" => ResolutionV4.x1312x736, - "1344x640" => ResolutionV4.x1344x640, - "1344x704" => ResolutionV4.x1344x704, - "1344x768" => ResolutionV4.x1344x768, - "1408x576" => ResolutionV4.x1408x576, - "1408x640" => ResolutionV4.x1408x640, - "1408x704" => ResolutionV4.x1408x704, - "1472x576" => ResolutionV4.x1472x576, - "1472x640" => ResolutionV4.x1472x640, - "1472x704" => ResolutionV4.x1472x704, - "1536x512" => ResolutionV4.x1536x512, - "1536x576" => ResolutionV4.x1536x576, - "1536x640" => ResolutionV4.x1536x640, - "512x1536" => ResolutionV4.x512x1536, - "512x512" => ResolutionV4.x512x512, - "576x1408" => ResolutionV4.x576x1408, - "576x1472" => ResolutionV4.x576x1472, - "576x1536" => ResolutionV4.x576x1536, - "640x1344" => ResolutionV4.x640x1344, - "640x1408" => ResolutionV4.x640x1408, - "640x1472" => ResolutionV4.x640x1472, - "640x1536" => ResolutionV4.x640x1536, - "704x1152" => ResolutionV4.x704x1152, - "704x1216" => ResolutionV4.x704x1216, - "704x1280" => ResolutionV4.x704x1280, - "704x1344" => ResolutionV4.x704x1344, - "704x1408" => ResolutionV4.x704x1408, - "704x1472" => ResolutionV4.x704x1472, - "736x1312" => ResolutionV4.x736x1312, - "768x1088" => ResolutionV4.x768x1088, - "768x1216" => ResolutionV4.x768x1216, - "768x1280" => ResolutionV4.x768x1280, - "768x1344" => ResolutionV4.x768x1344, - "800x1280" => ResolutionV4.x800x1280, - "832x1024" => ResolutionV4.x832x1024, - "832x1088" => ResolutionV4.x832x1088, - "832x1152" => ResolutionV4.x832x1152, - "832x1216" => ResolutionV4.x832x1216, - "832x1248" => ResolutionV4.x832x1248, - "832x960" => ResolutionV4.x832x960, - "864x1152" => ResolutionV4.x864x1152, - "896x1024" => ResolutionV4.x896x1024, - "896x1088" => ResolutionV4.x896x1088, - "896x1120" => ResolutionV4.x896x1120, - "896x1152" => ResolutionV4.x896x1152, - "896x960" => ResolutionV4.x896x960, - "960x1024" => ResolutionV4.x960x1024, - "960x1088" => ResolutionV4.x960x1088, - "960x832" => ResolutionV4.x960x832, - "960x896" => ResolutionV4.x960x896, + "1024x3072" => ResolutionV4.x1024x3072, + "1152x2944" => ResolutionV4.x1152x2944, + "1248x3328" => ResolutionV4.x1248x3328, + "1280x3072" => ResolutionV4.x1280x3072, + "1296x3168" => ResolutionV4.x1296x3168, + "1440x2560" => ResolutionV4.x1440x2560, + "1440x2880" => ResolutionV4.x1440x2880, + "1600x2560" => ResolutionV4.x1600x2560, + "1664x2496" => ResolutionV4.x1664x2496, + "1728x2304" => ResolutionV4.x1728x2304, + "1792x2240" => ResolutionV4.x1792x2240, + "2048x2048" => ResolutionV4.x2048x2048, + "2240x1792" => ResolutionV4.x2240x1792, + "2304x1728" => ResolutionV4.x2304x1728, + "2496x1664" => ResolutionV4.x2496x1664, + "2560x1440" => ResolutionV4.x2560x1440, + "2560x1600" => ResolutionV4.x2560x1600, + "2880x1440" => ResolutionV4.x2880x1440, + "2944x1152" => ResolutionV4.x2944x1152, + "3072x1024" => ResolutionV4.x3072x1024, + "3072x1280" => ResolutionV4.x3072x1280, + "3168x1296" => ResolutionV4.x3168x1296, + "3328x1248" => ResolutionV4.x3328x1248, _ => null, }; } diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4ImageToImage.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4ImageToImage.g.cs new file mode 100644 index 0000000..53e73df --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4ImageToImage.g.cs @@ -0,0 +1,184 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The resolutions supported for Ideogram 4.0 image-to-image generation.
+ /// Example: 1024x1024 + ///
+ public enum ResolutionV4ImageToImage + { + /// + /// + /// + x1024x1024, + /// + /// + /// + x1024x832, + /// + /// + /// + x1024x896, + /// + /// + /// + x1024x960, + /// + /// + /// + x1120x896, + /// + /// + /// + x1152x864, + /// + /// + /// + x1248x832, + /// + /// + /// + x1280x720, + /// + /// + /// + x1280x800, + /// + /// + /// + x1440x720, + /// + /// + /// + x512x512, + /// + /// + /// + x720x1280, + /// + /// + /// + x720x1440, + /// + /// + /// + x800x1280, + /// + /// + /// + x832x1024, + /// + /// + /// + x832x1248, + /// + /// + /// + x832x960, + /// + /// + /// + x864x1152, + /// + /// + /// + x896x1024, + /// + /// + /// + x896x1120, + /// + /// + /// + x896x960, + /// + /// + /// + x960x1024, + /// + /// + /// + x960x832, + /// + /// + /// + x960x896, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ResolutionV4ImageToImageExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ResolutionV4ImageToImage value) + { + return value switch + { + ResolutionV4ImageToImage.x1024x1024 => "1024x1024", + ResolutionV4ImageToImage.x1024x832 => "1024x832", + ResolutionV4ImageToImage.x1024x896 => "1024x896", + ResolutionV4ImageToImage.x1024x960 => "1024x960", + ResolutionV4ImageToImage.x1120x896 => "1120x896", + ResolutionV4ImageToImage.x1152x864 => "1152x864", + ResolutionV4ImageToImage.x1248x832 => "1248x832", + ResolutionV4ImageToImage.x1280x720 => "1280x720", + ResolutionV4ImageToImage.x1280x800 => "1280x800", + ResolutionV4ImageToImage.x1440x720 => "1440x720", + ResolutionV4ImageToImage.x512x512 => "512x512", + ResolutionV4ImageToImage.x720x1280 => "720x1280", + ResolutionV4ImageToImage.x720x1440 => "720x1440", + ResolutionV4ImageToImage.x800x1280 => "800x1280", + ResolutionV4ImageToImage.x832x1024 => "832x1024", + ResolutionV4ImageToImage.x832x1248 => "832x1248", + ResolutionV4ImageToImage.x832x960 => "832x960", + ResolutionV4ImageToImage.x864x1152 => "864x1152", + ResolutionV4ImageToImage.x896x1024 => "896x1024", + ResolutionV4ImageToImage.x896x1120 => "896x1120", + ResolutionV4ImageToImage.x896x960 => "896x960", + ResolutionV4ImageToImage.x960x1024 => "960x1024", + ResolutionV4ImageToImage.x960x832 => "960x832", + ResolutionV4ImageToImage.x960x896 => "960x896", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ResolutionV4ImageToImage? ToEnum(string value) + { + return value switch + { + "1024x1024" => ResolutionV4ImageToImage.x1024x1024, + "1024x832" => ResolutionV4ImageToImage.x1024x832, + "1024x896" => ResolutionV4ImageToImage.x1024x896, + "1024x960" => ResolutionV4ImageToImage.x1024x960, + "1120x896" => ResolutionV4ImageToImage.x1120x896, + "1152x864" => ResolutionV4ImageToImage.x1152x864, + "1248x832" => ResolutionV4ImageToImage.x1248x832, + "1280x720" => ResolutionV4ImageToImage.x1280x720, + "1280x800" => ResolutionV4ImageToImage.x1280x800, + "1440x720" => ResolutionV4ImageToImage.x1440x720, + "512x512" => ResolutionV4ImageToImage.x512x512, + "720x1280" => ResolutionV4ImageToImage.x720x1280, + "720x1440" => ResolutionV4ImageToImage.x720x1440, + "800x1280" => ResolutionV4ImageToImage.x800x1280, + "832x1024" => ResolutionV4ImageToImage.x832x1024, + "832x1248" => ResolutionV4ImageToImage.x832x1248, + "832x960" => ResolutionV4ImageToImage.x832x960, + "864x1152" => ResolutionV4ImageToImage.x864x1152, + "896x1024" => ResolutionV4ImageToImage.x896x1024, + "896x1120" => ResolutionV4ImageToImage.x896x1120, + "896x960" => ResolutionV4ImageToImage.x896x960, + "960x1024" => ResolutionV4ImageToImage.x960x1024, + "960x832" => ResolutionV4ImageToImage.x960x832, + "960x896" => ResolutionV4ImageToImage.x960x896, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4Layout.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4Layout.g.cs new file mode 100644 index 0000000..8221066 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ResolutionV4Layout.g.cs @@ -0,0 +1,118 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The resolutions supported for Ideogram 4.0 layout-to-image and design generation.
+ /// Example: 1024x1024 + ///
+ public enum ResolutionV4Layout + { + /// + /// + /// + x1024x1024, + /// + /// + /// + x1120x896, + /// + /// + /// + x1152x864, + /// + /// + /// + x1248x832, + /// + /// + /// + x1280x720, + /// + /// + /// + x1280x800, + /// + /// + /// + x1440x720, + /// + /// + /// + x720x1280, + /// + /// + /// + x720x1440, + /// + /// + /// + x800x1280, + /// + /// + /// + x832x1248, + /// + /// + /// + x864x1152, + /// + /// + /// + x896x1120, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ResolutionV4LayoutExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ResolutionV4Layout value) + { + return value switch + { + ResolutionV4Layout.x1024x1024 => "1024x1024", + ResolutionV4Layout.x1120x896 => "1120x896", + ResolutionV4Layout.x1152x864 => "1152x864", + ResolutionV4Layout.x1248x832 => "1248x832", + ResolutionV4Layout.x1280x720 => "1280x720", + ResolutionV4Layout.x1280x800 => "1280x800", + ResolutionV4Layout.x1440x720 => "1440x720", + ResolutionV4Layout.x720x1280 => "720x1280", + ResolutionV4Layout.x720x1440 => "720x1440", + ResolutionV4Layout.x800x1280 => "800x1280", + ResolutionV4Layout.x832x1248 => "832x1248", + ResolutionV4Layout.x864x1152 => "864x1152", + ResolutionV4Layout.x896x1120 => "896x1120", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ResolutionV4Layout? ToEnum(string value) + { + return value switch + { + "1024x1024" => ResolutionV4Layout.x1024x1024, + "1120x896" => ResolutionV4Layout.x1120x896, + "1152x864" => ResolutionV4Layout.x1152x864, + "1248x832" => ResolutionV4Layout.x1248x832, + "1280x720" => ResolutionV4Layout.x1280x720, + "1280x800" => ResolutionV4Layout.x1280x800, + "1440x720" => ResolutionV4Layout.x1440x720, + "720x1280" => ResolutionV4Layout.x720x1280, + "720x1440" => ResolutionV4Layout.x720x1440, + "800x1280" => ResolutionV4Layout.x800x1280, + "832x1248" => ResolutionV4Layout.x832x1248, + "864x1152" => ResolutionV4Layout.x864x1152, + "896x1120" => ResolutionV4Layout.x896x1120, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.SamplingRequestParams.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.SamplingRequestParams.g.cs index f7a8b58..8d3b633 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.SamplingRequestParams.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.SamplingRequestParams.g.cs @@ -4,7 +4,7 @@ namespace Ideogram { /// - /// Example: {"aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} + /// Example: {"magic_prompt_system_prompt_config_id":"magic_prompt_system_prompt_config_id","aspect_ratio":"1x1","style_type":"GENERAL","magic_prompt_version":"V_0","seed":12345,"negative_prompt":"brush strokes, painting","magic_prompt_option":"ON","model":"V_2_TURBO","resolution":"1280x800","num_images":1,"color_palette":{"name":"PASTEL"}} /// public sealed partial class SamplingRequestParams { @@ -35,6 +35,12 @@ public sealed partial class SamplingRequestParams [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -114,6 +120,9 @@ public sealed partial class SamplingRequestParams /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -149,6 +158,7 @@ public SamplingRequestParams( global::Ideogram.AspectRatioV3? aspectRatio, global::Ideogram.ModelEnum? model, global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, global::Ideogram.MagicPromptVersionEnum? magicPromptVersion, int? seed, global::Ideogram.StyleTypeV3? styleType, @@ -160,6 +170,7 @@ public SamplingRequestParams( this.AspectRatio = aspectRatio; this.Model = model; this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.MagicPromptVersion = magicPromptVersion; this.Seed = seed; this.StyleType = styleType; @@ -175,5 +186,6 @@ public SamplingRequestParams( public SamplingRequestParams() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfo.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfo.g.cs index eb334c4..cf8e1a5 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfo.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfo.g.cs @@ -96,5 +96,6 @@ public SpendCommitInfo( public SpendCommitInfo() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfoResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfoResponse.g.cs index eaa944d..0bf6835 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfoResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.SpendCommitInfoResponse.g.cs @@ -42,5 +42,6 @@ public SpendCommitInfoResponse( public SpendCommitInfoResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TextContainerV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TextContainerV3.g.cs index d10fabe..29fce3e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TextContainerV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TextContainerV3.g.cs @@ -5,7 +5,7 @@ namespace Ideogram { /// /// A spatial grouping of related text items that form a cohesive visual unit (e.g., a title group, a list, a card).
- /// Example: {"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5}]} + /// Example: {"id":"id","items":[{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5},{"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5}]} ///
public sealed partial class TextContainerV3 { @@ -55,5 +55,6 @@ public TextContainerV3( public TextContainerV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3.g.cs index 30dda9c..536a061 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3.g.cs @@ -5,7 +5,7 @@ namespace Ideogram { /// /// A single text block within a container, representing one logical unit of text (e.g., a headline, a paragraph, a list entry).
- /// Example: {"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"font_size":5,"glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","height":5} + /// Example: {"font_candidates":["font_candidates","font_candidates"],"spans":[{"color":"#212121","text":"text","font_fx":["bold","italic"]},{"color":"#212121","text":"text","font_fx":["bold","italic"]}],"text_shadows":[{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767},{"color":"color","blur":0.2027123,"offset_x":9.301444,"offset_y":3.6160767}],"font_size":5,"vertical_alignment":"top","text_transform":"none","glyph_type":"bullet","line_height":2.302136,"x":0,"width":1,"style_class":"body","y":6,"angle":0,"alignment":"center","font_file":"font_file","letter_spacing":7.0614014,"height":5} ///
public sealed partial class TextItemV3 { @@ -98,6 +98,35 @@ public sealed partial class TextItemV3 [global::System.Text.Json.Serialization.JsonPropertyName("line_height")] public float? LineHeight { get; set; } + /// + /// Letter spacing in em units (e.g. 0.05 = 5% of em). V4 vector-text only. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("letter_spacing")] + public float? LetterSpacing { get; set; } + + /// + /// Case folding applied at render time. V4 vector-text only. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text_transform")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.TextItemV3TextTransformJsonConverter))] + public global::Ideogram.TextItemV3TextTransform? TextTransform { get; set; } + + /// + /// Vertical anchor (top|middle|bottom) for the rendered text within
+ /// its bounding box. Maps to SVG `dominant-baseline`. V4 vector-text
+ /// only. Distinct from horizontal `alignment` (left|center|right). + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("vertical_alignment")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.TextItemV3VerticalAlignmentJsonConverter))] + public global::Ideogram.TextItemV3VerticalAlignment? VerticalAlignment { get; set; } + + /// + /// Stacked CSS text shadows, composed back-to-front. Phase-1 ships at
+ /// most one entry; phase-2 unlocks multi-stack. V4 vector-text only. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("text_shadows")] + public global::System.Collections.Generic.IList? TextShadows { get; set; } + /// /// Ordered list of text spans. Concatenating span text values produces the full item text. /// @@ -157,6 +186,21 @@ public sealed partial class TextItemV3 /// /// The line height multiplier (e.g., 1.2). Null for non-editable items. /// + /// + /// Letter spacing in em units (e.g. 0.05 = 5% of em). V4 vector-text only. + /// + /// + /// Case folding applied at render time. V4 vector-text only. + /// + /// + /// Vertical anchor (top|middle|bottom) for the rendered text within
+ /// its bounding box. Maps to SVG `dominant-baseline`. V4 vector-text
+ /// only. Distinct from horizontal `alignment` (left|center|right). + /// + /// + /// Stacked CSS text shadows, composed back-to-front. Phase-1 ships at
+ /// most one entry; phase-2 unlocks multi-stack. V4 vector-text only. + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -173,7 +217,11 @@ public TextItemV3( string? fontFile, global::System.Collections.Generic.IList? fontCandidates, int? fontSize, - float? lineHeight) + float? lineHeight, + float? letterSpacing, + global::Ideogram.TextItemV3TextTransform? textTransform, + global::Ideogram.TextItemV3VerticalAlignment? verticalAlignment, + global::System.Collections.Generic.IList? textShadows) { this.X = x; this.Y = y; @@ -187,6 +235,10 @@ public TextItemV3( this.FontCandidates = fontCandidates; this.FontSize = fontSize; this.LineHeight = lineHeight; + this.LetterSpacing = letterSpacing; + this.TextTransform = textTransform; + this.VerticalAlignment = verticalAlignment; + this.TextShadows = textShadows; this.Spans = spans ?? throw new global::System.ArgumentNullException(nameof(spans)); } @@ -196,5 +248,6 @@ public TextItemV3( public TextItemV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3TextTransform.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3TextTransform.g.cs new file mode 100644 index 0000000..95ada3c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3TextTransform.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Case folding applied at render time. V4 vector-text only. + /// + public enum TextItemV3TextTransform + { + /// + /// + /// + Lowercase, + /// + /// + /// + None, + /// + /// + /// + Uppercase, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class TextItemV3TextTransformExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this TextItemV3TextTransform value) + { + return value switch + { + TextItemV3TextTransform.Lowercase => "lowercase", + TextItemV3TextTransform.None => "none", + TextItemV3TextTransform.Uppercase => "uppercase", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static TextItemV3TextTransform? ToEnum(string value) + { + return value switch + { + "lowercase" => TextItemV3TextTransform.Lowercase, + "none" => TextItemV3TextTransform.None, + "uppercase" => TextItemV3TextTransform.Uppercase, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3VerticalAlignment.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3VerticalAlignment.g.cs new file mode 100644 index 0000000..5992d1a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TextItemV3VerticalAlignment.g.cs @@ -0,0 +1,59 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Vertical anchor (top|middle|bottom) for the rendered text within
+ /// its bounding box. Maps to SVG `dominant-baseline`. V4 vector-text
+ /// only. Distinct from horizontal `alignment` (left|center|right). + ///
+ public enum TextItemV3VerticalAlignment + { + /// + /// + /// + Bottom, + /// + /// + /// + Middle, + /// + /// + /// + Top, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class TextItemV3VerticalAlignmentExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this TextItemV3VerticalAlignment value) + { + return value switch + { + TextItemV3VerticalAlignment.Bottom => "bottom", + TextItemV3VerticalAlignment.Middle => "middle", + TextItemV3VerticalAlignment.Top => "top", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static TextItemV3VerticalAlignment? ToEnum(string value) + { + return value switch + { + "bottom" => TextItemV3VerticalAlignment.Bottom, + "middle" => TextItemV3VerticalAlignment.Middle, + "top" => TextItemV3VerticalAlignment.Top, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TextSpanV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TextSpanV3.g.cs index 3f98862..f82c34a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TextSpanV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TextSpanV3.g.cs @@ -75,5 +75,6 @@ public TextSpanV3( public TextSpanV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.ToolUsage.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.ToolUsage.g.cs index 60a3aec..2117265 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.ToolUsage.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.ToolUsage.g.cs @@ -61,6 +61,8 @@ public sealed partial class ToolUsage /// - V_3_0: Model 3.0 March 26
/// - V_3_1: Model 3.0 Latest
/// - V_4_0: Model 4.0
+ /// - V_4_D: Model 4.0 Layered Design (vector-text path; gated by the access_to_v4 feature flag)
+ /// - V_4_LAYOUT2IMAGE: Model 4.0 Layout to Image (HTML layout rasterized as IMAGE_TO_IMAGE conditioning; gated by the access_to_v4 feature flag)
/// - AUTO: Automatically select the best model version based on the request.
/// Example: V_0_3 ///
@@ -107,6 +109,8 @@ public sealed partial class ToolUsage /// - V_3_0: Model 3.0 March 26
/// - V_3_1: Model 3.0 Latest
/// - V_4_0: Model 4.0
+ /// - V_4_D: Model 4.0 Layered Design (vector-text path; gated by the access_to_v4 feature flag)
+ /// - V_4_LAYOUT2IMAGE: Model 4.0 Layout to Image (HTML layout rasterized as IMAGE_TO_IMAGE conditioning; gated by the access_to_v4 feature flag)
/// - AUTO: Automatically select the best model version based on the request.
/// Example: V_0_3 /// @@ -135,5 +139,6 @@ public ToolUsage( public ToolUsage() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelRequest.g.cs index 5f40cba..8cfd82d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelRequest.g.cs @@ -46,5 +46,6 @@ public TrainDatasetModelRequest( public TrainDatasetModelRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelResponse.g.cs index 4d52c2a..9147126 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TrainDatasetModelResponse.g.cs @@ -78,5 +78,6 @@ public TrainDatasetModelResponse( public TrainDatasetModelResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3AdvancedRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3AdvancedRequest.g.cs index 1b5efc2..7abd7b0 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3AdvancedRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3AdvancedRequest.g.cs @@ -117,5 +117,6 @@ public TrainModelV3AdvancedRequest( public TrainModelV3AdvancedRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3Request.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3Request.g.cs index db2f371..b347c06 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3Request.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TrainModelV3Request.g.cs @@ -61,5 +61,6 @@ public TrainModelV3Request( public TrainModelV3Request() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TrainingRun.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TrainingRun.g.cs index 74ecba2..7eb5b5a 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TrainingRun.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TrainingRun.g.cs @@ -134,5 +134,6 @@ public TrainingRun( public TrainingRun() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.TryOnRequestV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.TryOnRequestV3.g.cs index 0518777..1df9057 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.TryOnRequestV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.TryOnRequestV3.g.cs @@ -40,6 +40,12 @@ public sealed partial class TryOnRequestV3 [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The number of images to generate.
/// Default Value: 1 @@ -116,6 +122,9 @@ public sealed partial class TryOnRequestV3 /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The number of images to generate.
/// Default Value: 1 @@ -146,6 +155,7 @@ public TryOnRequestV3( global::System.Collections.Generic.IList productReferenceImages, string? prompt, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, int? numImages, int? seed, global::Ideogram.RenderingSpeed? renderingSpeed, @@ -156,6 +166,7 @@ public TryOnRequestV3( this.Imagename = imagename ?? throw new global::System.ArgumentNullException(nameof(imagename)); this.Prompt = prompt; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.NumImages = numImages; this.Seed = seed; this.RenderingSpeed = renderingSpeed; @@ -170,5 +181,6 @@ public TryOnRequestV3( public TryOnRequestV3() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesRequest.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesRequest.Json.g.cs new file mode 100644 index 0000000..5e1afcd --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class UpdateOrganizationApiPropertiesRequest + { + /// + /// 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.UpdateOrganizationApiPropertiesRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.UpdateOrganizationApiPropertiesRequest), + jsonSerializerContext) as global::Ideogram.UpdateOrganizationApiPropertiesRequest; + } + + /// + /// 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.UpdateOrganizationApiPropertiesRequest? 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.UpdateOrganizationApiPropertiesRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.UpdateOrganizationApiPropertiesRequest; + } + + /// + /// 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.UpdateOrganizationApiPropertiesRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesRequest.g.cs new file mode 100644 index 0000000..9f52f88 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesRequest.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Partial update for an organization's API-only properties. Only fields explicitly present are written; unset fields preserve their current value.
+ /// Example: {"copyright_detection_enabled":true} + ///
+ public sealed partial class UpdateOrganizationApiPropertiesRequest + { + /// + /// Toggle post-generation Hive likeness + logo detection for this organization. See ApiProfile.copyright_detection_enabled for behavior. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("copyright_detection_enabled")] + public bool? CopyrightDetectionEnabled { 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. + /// + /// + /// Toggle post-generation Hive likeness + logo detection for this organization. See ApiProfile.copyright_detection_enabled for behavior. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public UpdateOrganizationApiPropertiesRequest( + bool? copyrightDetectionEnabled) + { + this.CopyrightDetectionEnabled = copyrightDetectionEnabled; + } + + /// + /// Initializes a new instance of the class. + /// + public UpdateOrganizationApiPropertiesRequest() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesResponse.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesResponse.Json.g.cs new file mode 100644 index 0000000..9b5a486 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class UpdateOrganizationApiPropertiesResponse + { + /// + /// 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.UpdateOrganizationApiPropertiesResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.UpdateOrganizationApiPropertiesResponse), + jsonSerializerContext) as global::Ideogram.UpdateOrganizationApiPropertiesResponse; + } + + /// + /// 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.UpdateOrganizationApiPropertiesResponse? 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.UpdateOrganizationApiPropertiesResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.UpdateOrganizationApiPropertiesResponse; + } + + /// + /// 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.UpdateOrganizationApiPropertiesResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesResponse.g.cs new file mode 100644 index 0000000..338bc43 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpdateOrganizationApiPropertiesResponse.g.cs @@ -0,0 +1,47 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Example: {"copyright_detection_enabled":true} + /// + public sealed partial class UpdateOrganizationApiPropertiesResponse + { + /// + /// The setting after the update. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("copyright_detection_enabled")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool CopyrightDetectionEnabled { 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. + /// + /// + /// The setting after the update. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public UpdateOrganizationApiPropertiesResponse( + bool copyrightDetectionEnabled) + { + this.CopyrightDetectionEnabled = copyrightDetectionEnabled; + } + + /// + /// Initializes a new instance of the class. + /// + public UpdateOrganizationApiPropertiesResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsRequest.g.cs index c92880d..bb6feb3 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsRequest.g.cs @@ -42,5 +42,6 @@ public UploadDatasetAssetsRequest( public UploadDatasetAssetsRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsResponse.g.cs index c7e7d60..062b149 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UploadDatasetAssetsResponse.g.cs @@ -92,5 +92,6 @@ public UploadDatasetAssetsResponse( public UploadDatasetAssetsResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleImageRequest.g.cs index 3818ba2..d3c1153 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleImageRequest.g.cs @@ -66,5 +66,6 @@ public UpscaleImageRequest( public UpscaleImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleInitialImageRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleInitialImageRequest.g.cs index 3cd98bb..cfbccfc 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleInitialImageRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UpscaleInitialImageRequest.g.cs @@ -41,6 +41,12 @@ public sealed partial class UpscaleInitialImageRequest [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPromptOption { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -90,6 +96,9 @@ public sealed partial class UpscaleInitialImageRequest /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The magic prompt version to use when magic prompt option is set to AUTO or ON.
/// Example: V_0 @@ -110,6 +119,7 @@ public UpscaleInitialImageRequest( int? resemblance, int? detail, global::Ideogram.MagicPromptOption? magicPromptOption, + string? magicPromptSystemPromptConfigId, global::Ideogram.MagicPromptVersionEnum? magicPromptVersion, int? numImages, int? seed) @@ -118,6 +128,7 @@ public UpscaleInitialImageRequest( this.Resemblance = resemblance; this.Detail = detail; this.MagicPromptOption = magicPromptOption; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.MagicPromptVersion = magicPromptVersion; this.NumImages = numImages; this.Seed = seed; @@ -129,5 +140,6 @@ public UpscaleInitialImageRequest( public UpscaleInitialImageRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.UsageSegment.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.UsageSegment.g.cs index c2bc561..ca44505 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.UsageSegment.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.UsageSegment.g.cs @@ -72,5 +72,6 @@ public UsageSegment( public UsageSegment() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImageObject.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImageObject.g.cs index cdfd227..9dd9873 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImageObject.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImageObject.g.cs @@ -132,5 +132,6 @@ public V1EditImageObject( public V1EditImageObject() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesRequest.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesRequest.g.cs index 64369e8..2c16599 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesRequest.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesRequest.g.cs @@ -53,6 +53,12 @@ public sealed partial class V1EditImagesRequest [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.MagicPromptOptionJsonConverter))] public global::Ideogram.MagicPromptOption? MagicPrompt { get; set; } + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("magic_prompt_system_prompt_config_id")] + public string? MagicPromptSystemPromptConfigId { get; set; } + /// /// The resolutions supported for Ideogram 3.0.
/// Example: 1280x800 @@ -107,6 +113,9 @@ public sealed partial class V1EditImagesRequest /// Determine if MagicPrompt should be used in generating the request or not.
/// Example: ON /// + /// + /// A base64url-encoded magic prompt system prompt config ID to use for this request. + /// /// /// The resolutions supported for Ideogram 3.0.
/// Example: 1280x800 @@ -128,6 +137,7 @@ public V1EditImagesRequest( int? numImages, int? seed, global::Ideogram.MagicPromptOption? magicPrompt, + string? magicPromptSystemPromptConfigId, global::Ideogram.ResolutionV3? resolution, global::Ideogram.AspectRatioV3? aspectRatio, bool? transparentBackground) @@ -138,6 +148,7 @@ public V1EditImagesRequest( this.NumImages = numImages; this.Seed = seed; this.MagicPrompt = magicPrompt; + this.MagicPromptSystemPromptConfigId = magicPromptSystemPromptConfigId; this.Resolution = resolution; this.AspectRatio = aspectRatio; this.TransparentBackground = transparentBackground; @@ -149,5 +160,6 @@ public V1EditImagesRequest( public V1EditImagesRequest() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesResponse.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesResponse.g.cs index 337ad7e..db711ff 100644 --- a/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesResponse.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V1EditImagesResponse.g.cs @@ -56,5 +56,6 @@ public V1EditImagesResponse( public V1EditImagesResponse() { } + } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4CompositionalDeconstruction.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4CompositionalDeconstruction.Json.g.cs new file mode 100644 index 0000000..39c1da4 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4CompositionalDeconstruction.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4CompositionalDeconstruction + { + /// + /// 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.V4CompositionalDeconstruction? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4CompositionalDeconstruction), + jsonSerializerContext) as global::Ideogram.V4CompositionalDeconstruction; + } + + /// + /// 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.V4CompositionalDeconstruction? 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.V4CompositionalDeconstruction), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4CompositionalDeconstruction; + } + + /// + /// 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.V4CompositionalDeconstruction.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4CompositionalDeconstruction.g.cs new file mode 100644 index 0000000..2dc2e98 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4CompositionalDeconstruction.g.cs @@ -0,0 +1,60 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// The compositional breakdown of a V4 prompt — background plus an ordered list of elements.
+ /// Example: {"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]} + ///
+ public sealed partial class V4CompositionalDeconstruction + { + /// + /// Description of the background of the scene. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("background")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Background { get; set; } + + /// + /// Ordered list of elements (objects and text) composing the scene. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("elements")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Elements { 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. + /// + /// + /// Description of the background of the scene. + /// + /// + /// Ordered list of elements (objects and text) composing the scene. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4CompositionalDeconstruction( + string background, + global::System.Collections.Generic.IList elements) + { + this.Background = background ?? throw new global::System.ArgumentNullException(nameof(background)); + this.Elements = elements ?? throw new global::System.ArgumentNullException(nameof(elements)); + } + + /// + /// Initializes a new instance of the class. + /// + public V4CompositionalDeconstruction() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4JsonPrompt.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4JsonPrompt.Json.g.cs new file mode 100644 index 0000000..694901c --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4JsonPrompt.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4JsonPrompt + { + /// + /// 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.V4JsonPrompt? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4JsonPrompt), + jsonSerializerContext) as global::Ideogram.V4JsonPrompt; + } + + /// + /// 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.V4JsonPrompt? 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.V4JsonPrompt), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4JsonPrompt; + } + + /// + /// 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.V4JsonPrompt.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4JsonPrompt.g.cs new file mode 100644 index 0000000..e7bbbea --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4JsonPrompt.g.cs @@ -0,0 +1,93 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Structured prompt for Ideogram 4.0 generation. When `json_prompt` is
+ /// supplied, magic-prompt is disabled and the diffusion model consumes
+ /// the JSON contract directly. Mutually exclusive with `text_prompt`
+ /// and the legacy `prompt` field.
+ /// Example: {"high_level_description":"high_level_description","style_description":{"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"},"compositional_deconstruction":{"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]},"tags":["tags","tags"]} + ///
+ public sealed partial class V4JsonPrompt + { + /// + /// One- or two-sentence overall description of the desired image. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("high_level_description")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string HighLevelDescription { get; set; } + + /// + /// Optional style description supplied alongside a V4 JSON prompt.
+ /// Example: {"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"} + ///
+ /// {"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"} + [global::System.Text.Json.Serialization.JsonPropertyName("style_description")] + public global::Ideogram.V4StyleDescription? StyleDescription { get; set; } + + /// + /// The compositional breakdown of a V4 prompt — background plus an ordered list of elements.
+ /// Example: {"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]} + ///
+ /// {"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]} + [global::System.Text.Json.Serialization.JsonPropertyName("compositional_deconstruction")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Ideogram.V4CompositionalDeconstruction CompositionalDeconstruction { get; set; } + + /// + /// Round-trip metadata surfaced by the describe endpoint when
+ /// `strip_tags=false`. Ignored by the v4 sampler on generate input. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("tags")] + public global::System.Collections.Generic.IList? Tags { 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. + /// + /// + /// One- or two-sentence overall description of the desired image. + /// + /// + /// The compositional breakdown of a V4 prompt — background plus an ordered list of elements.
+ /// Example: {"background":"background","elements":[{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"},{"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"}]} + /// + /// + /// Optional style description supplied alongside a V4 JSON prompt.
+ /// Example: {"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"} + /// + /// + /// Round-trip metadata surfaced by the describe endpoint when
+ /// `strip_tags=false`. Ignored by the v4 sampler on generate input. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4JsonPrompt( + string highLevelDescription, + global::Ideogram.V4CompositionalDeconstruction compositionalDeconstruction, + global::Ideogram.V4StyleDescription? styleDescription, + global::System.Collections.Generic.IList? tags) + { + this.HighLevelDescription = highLevelDescription ?? throw new global::System.ArgumentNullException(nameof(highLevelDescription)); + this.StyleDescription = styleDescription; + this.CompositionalDeconstruction = compositionalDeconstruction ?? throw new global::System.ArgumentNullException(nameof(compositionalDeconstruction)); + this.Tags = tags; + } + + /// + /// Initializes a new instance of the class. + /// + public V4JsonPrompt() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElement.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElement.Json.g.cs new file mode 100644 index 0000000..626ea4a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElement.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4ObjPromptElement + { + /// + /// 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.V4ObjPromptElement? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4ObjPromptElement), + jsonSerializerContext) as global::Ideogram.V4ObjPromptElement; + } + + /// + /// 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.V4ObjPromptElement? 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.V4ObjPromptElement), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4ObjPromptElement; + } + + /// + /// 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.V4ObjPromptElement.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElement.g.cs new file mode 100644 index 0000000..8d488b6 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElement.g.cs @@ -0,0 +1,80 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// A non-text element (object, character, background detail) in the V4 prompt layout.
+ /// Example: {"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"} + ///
+ public sealed partial class V4ObjPromptElement + { + /// + /// Discriminator. Must be `obj`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.V4ObjPromptElementTypeJsonConverter))] + public global::Ideogram.V4ObjPromptElementType Type { get; set; } + + /// + /// Bounding box for an element, expressed as four integers in `[0, 1000]`
+ /// with `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are
+ /// normalized so the canvas is `1000 x 1000` regardless of the final
+ /// resolution.
+ /// Example: [0, 0, 1000, 1000] + ///
+ /// [0, 0, 1000, 1000] + [global::System.Text.Json.Serialization.JsonPropertyName("bbox")] + public global::System.Collections.Generic.IList? Bbox { get; set; } + + /// + /// Description of the object element. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("desc")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Desc { 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. + /// + /// + /// Description of the object element. + /// + /// + /// Discriminator. Must be `obj`. + /// + /// + /// Bounding box for an element, expressed as four integers in `[0, 1000]`
+ /// with `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are
+ /// normalized so the canvas is `1000 x 1000` regardless of the final
+ /// resolution.
+ /// Example: [0, 0, 1000, 1000] + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4ObjPromptElement( + string desc, + global::Ideogram.V4ObjPromptElementType type, + global::System.Collections.Generic.IList? bbox) + { + this.Type = type; + this.Bbox = bbox; + this.Desc = desc ?? throw new global::System.ArgumentNullException(nameof(desc)); + } + + /// + /// Initializes a new instance of the class. + /// + public V4ObjPromptElement() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElementType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElementType.g.cs new file mode 100644 index 0000000..f451794 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4ObjPromptElementType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Discriminator. Must be `obj`. + /// + public enum V4ObjPromptElementType + { + /// + /// + /// + Obj, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class V4ObjPromptElementTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this V4ObjPromptElementType value) + { + return value switch + { + V4ObjPromptElementType.Obj => "obj", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static V4ObjPromptElementType? ToEnum(string value) + { + return value switch + { + "obj" => V4ObjPromptElementType.Obj, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElement.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElement.Json.g.cs new file mode 100644 index 0000000..1998803 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElement.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public readonly partial struct V4PromptElement + { + /// + /// 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.V4PromptElement? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4PromptElement), + jsonSerializerContext) as global::Ideogram.V4PromptElement?; + } + + /// + /// 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.V4PromptElement? 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.V4PromptElement), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4PromptElement?; + } + + /// + /// 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.V4PromptElement.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElement.g.cs new file mode 100644 index 0000000..672c303 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElement.g.cs @@ -0,0 +1,305 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Ideogram +{ + /// + /// A single element in the V4 prompt's compositional deconstruction.
+ /// Discriminated by the `type` field. + ///
+ public readonly partial struct V4PromptElement : global::System.IEquatable + { + /// + /// + /// + public global::Ideogram.V4PromptElementDiscriminatorType? Type { get; } + + /// + /// A non-text element (object, character, background detail) in the V4 prompt layout.
+ /// Example: {"bbox":[0,0,1000,1000],"type":"obj","desc":"desc"} + ///
+#if NET6_0_OR_GREATER + public global::Ideogram.V4ObjPromptElement? Obj { get; init; } +#else + public global::Ideogram.V4ObjPromptElement? Obj { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Obj))] +#endif + public bool IsObj => Obj != null; + + /// + /// + /// + public bool TryPickObj( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.V4ObjPromptElement? value) + { + value = Obj; + return IsObj; + } + + /// + /// + /// + public global::Ideogram.V4ObjPromptElement PickObj() => IsObj + ? Obj! + : throw new global::System.InvalidOperationException($"Expected union variant 'Obj' but the value was {ToString()}."); + + /// + /// A text element to render in the V4 prompt layout. + /// +#if NET6_0_OR_GREATER + public global::Ideogram.V4TextPromptElement? Text { get; init; } +#else + public global::Ideogram.V4TextPromptElement? Text { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Text))] +#endif + public bool IsText => Text != null; + + /// + /// + /// + public bool TryPickText( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Ideogram.V4TextPromptElement? value) + { + value = Text; + return IsText; + } + + /// + /// + /// + public global::Ideogram.V4TextPromptElement PickText() => IsText + ? Text! + : throw new global::System.InvalidOperationException($"Expected union variant 'Text' but the value was {ToString()}."); + /// + /// + /// + public static implicit operator V4PromptElement(global::Ideogram.V4ObjPromptElement value) => new V4PromptElement((global::Ideogram.V4ObjPromptElement?)value); + + /// + /// + /// + public static implicit operator global::Ideogram.V4ObjPromptElement?(V4PromptElement @this) => @this.Obj; + + /// + /// + /// + public V4PromptElement(global::Ideogram.V4ObjPromptElement? value) + { + Obj = value; + } + + /// + /// + /// + public static V4PromptElement FromObj(global::Ideogram.V4ObjPromptElement? value) => new V4PromptElement(value); + + /// + /// + /// + public static implicit operator V4PromptElement(global::Ideogram.V4TextPromptElement value) => new V4PromptElement((global::Ideogram.V4TextPromptElement?)value); + + /// + /// + /// + public static implicit operator global::Ideogram.V4TextPromptElement?(V4PromptElement @this) => @this.Text; + + /// + /// + /// + public V4PromptElement(global::Ideogram.V4TextPromptElement? value) + { + Text = value; + } + + /// + /// + /// + public static V4PromptElement FromText(global::Ideogram.V4TextPromptElement? value) => new V4PromptElement(value); + + /// + /// + /// + public V4PromptElement( + global::Ideogram.V4PromptElementDiscriminatorType? type, + global::Ideogram.V4ObjPromptElement? obj, + global::Ideogram.V4TextPromptElement? text + ) + { + Type = type; + + Obj = obj; + Text = text; + } + + /// + /// + /// + public object? Object => + Text as object ?? + Obj as object + ; + + /// + /// + /// + public override string? ToString() => + Obj?.ToString() ?? + Text?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsObj && !IsText || !IsObj && IsText; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? obj = null, + global::System.Func? text = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsObj && obj != null) + { + return obj(Obj!); + } + else if (IsText && text != null) + { + return text(Text!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? obj = null, + + global::System.Action? text = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsObj) + { + obj?.Invoke(Obj!); + } + else if (IsText) + { + text?.Invoke(Text!); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? obj = null, + global::System.Action? text = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsObj) + { + obj?.Invoke(Obj!); + } + else if (IsText) + { + text?.Invoke(Text!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Obj, + typeof(global::Ideogram.V4ObjPromptElement), + Text, + typeof(global::Ideogram.V4TextPromptElement), + }; + 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 global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(V4PromptElement other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Obj, other.Obj) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Text, other.Text) + ; + } + + /// + /// + /// + public static bool operator ==(V4PromptElement obj1, V4PromptElement obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(V4PromptElement obj1, V4PromptElement obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is V4PromptElement o && Equals(o); + } + } +} diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminator.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminator.Json.g.cs new file mode 100644 index 0000000..be9bb6f --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminator.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4PromptElementDiscriminator + { + /// + /// 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.V4PromptElementDiscriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4PromptElementDiscriminator), + jsonSerializerContext) as global::Ideogram.V4PromptElementDiscriminator; + } + + /// + /// 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.V4PromptElementDiscriminator? 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.V4PromptElementDiscriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4PromptElementDiscriminator; + } + + /// + /// 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.V4PromptElementDiscriminator.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminator.g.cs new file mode 100644 index 0000000..4b8463e --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminator.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public sealed partial class V4PromptElementDiscriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.V4PromptElementDiscriminatorTypeJsonConverter))] + public global::Ideogram.V4PromptElementDiscriminatorType? Type { 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. + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4PromptElementDiscriminator( + global::Ideogram.V4PromptElementDiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public V4PromptElementDiscriminator() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminatorType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminatorType.g.cs new file mode 100644 index 0000000..51fdc83 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4PromptElementDiscriminatorType.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// + /// + public enum V4PromptElementDiscriminatorType + { + /// + /// + /// + Obj, + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class V4PromptElementDiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this V4PromptElementDiscriminatorType value) + { + return value switch + { + V4PromptElementDiscriminatorType.Obj => "obj", + V4PromptElementDiscriminatorType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static V4PromptElementDiscriminatorType? ToEnum(string value) + { + return value switch + { + "obj" => V4PromptElementDiscriminatorType.Obj, + "text" => V4PromptElementDiscriminatorType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4StyleDescription.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4StyleDescription.Json.g.cs new file mode 100644 index 0000000..9f27918 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4StyleDescription.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4StyleDescription + { + /// + /// 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.V4StyleDescription? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4StyleDescription), + jsonSerializerContext) as global::Ideogram.V4StyleDescription; + } + + /// + /// 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.V4StyleDescription? 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.V4StyleDescription), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4StyleDescription; + } + + /// + /// 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.V4StyleDescription.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4StyleDescription.g.cs new file mode 100644 index 0000000..3a037ca --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4StyleDescription.g.cs @@ -0,0 +1,91 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Optional style description supplied alongside a V4 JSON prompt.
+ /// Example: {"photo":"photo","art_style":"art_style","medium":"medium","aesthetics":"aesthetics","lighting":"lighting"} + ///
+ public sealed partial class V4StyleDescription + { + /// + /// Aesthetic notes (mood, vibe, references). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("aesthetics")] + public string? Aesthetics { get; set; } + + /// + /// Optional art-style hint (e.g., illustration, oil painting). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("art_style")] + public string? ArtStyle { get; set; } + + /// + /// Lighting description. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("lighting")] + public string? Lighting { get; set; } + + /// + /// Medium description (e.g., photograph, digital art). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("medium")] + public string? Medium { get; set; } + + /// + /// Optional photographic style notes (e.g., lens, film stock). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("photo")] + public string? Photo { 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. + /// + /// + /// Aesthetic notes (mood, vibe, references). + /// + /// + /// Optional art-style hint (e.g., illustration, oil painting). + /// + /// + /// Lighting description. + /// + /// + /// Medium description (e.g., photograph, digital art). + /// + /// + /// Optional photographic style notes (e.g., lens, film stock). + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4StyleDescription( + string? aesthetics, + string? artStyle, + string? lighting, + string? medium, + string? photo) + { + this.Aesthetics = aesthetics; + this.ArtStyle = artStyle; + this.Lighting = lighting; + this.Medium = medium; + this.Photo = photo; + } + + /// + /// Initializes a new instance of the class. + /// + public V4StyleDescription() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElement.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElement.Json.g.cs new file mode 100644 index 0000000..134f624 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElement.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class V4TextPromptElement + { + /// + /// 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.V4TextPromptElement? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.V4TextPromptElement), + jsonSerializerContext) as global::Ideogram.V4TextPromptElement; + } + + /// + /// 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.V4TextPromptElement? 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.V4TextPromptElement), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.V4TextPromptElement; + } + + /// + /// 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.V4TextPromptElement.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElement.g.cs new file mode 100644 index 0000000..fc3072a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElement.g.cs @@ -0,0 +1,91 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// A text element to render in the V4 prompt layout. + /// + public sealed partial class V4TextPromptElement + { + /// + /// Discriminator. Must be `text`. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ideogram.JsonConverters.V4TextPromptElementTypeJsonConverter))] + public global::Ideogram.V4TextPromptElementType Type { get; set; } + + /// + /// Bounding box for an element, expressed as four integers in `[0, 1000]`
+ /// with `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are
+ /// normalized so the canvas is `1000 x 1000` regardless of the final
+ /// resolution.
+ /// Example: [0, 0, 1000, 1000] + ///
+ /// [0, 0, 1000, 1000] + [global::System.Text.Json.Serialization.JsonPropertyName("bbox")] + public global::System.Collections.Generic.IList? Bbox { get; set; } + + /// + /// The literal text to render in the image. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("text")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Text { get; set; } + + /// + /// Description of the text element (style, role, placement notes). + /// + [global::System.Text.Json.Serialization.JsonPropertyName("desc")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Desc { 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. + /// + /// + /// The literal text to render in the image. + /// + /// + /// Description of the text element (style, role, placement notes). + /// + /// + /// Discriminator. Must be `text`. + /// + /// + /// Bounding box for an element, expressed as four integers in `[0, 1000]`
+ /// with `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are
+ /// normalized so the canvas is `1000 x 1000` regardless of the final
+ /// resolution.
+ /// Example: [0, 0, 1000, 1000] + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public V4TextPromptElement( + string text, + string desc, + global::Ideogram.V4TextPromptElementType type, + global::System.Collections.Generic.IList? bbox) + { + this.Type = type; + this.Bbox = bbox; + this.Text = text ?? throw new global::System.ArgumentNullException(nameof(text)); + this.Desc = desc ?? throw new global::System.ArgumentNullException(nameof(desc)); + } + + /// + /// Initializes a new instance of the class. + /// + public V4TextPromptElement() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElementType.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElementType.g.cs new file mode 100644 index 0000000..e085d03 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.V4TextPromptElementType.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Discriminator. Must be `text`. + /// + public enum V4TextPromptElementType + { + /// + /// + /// + Text, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class V4TextPromptElementTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this V4TextPromptElementType value) + { + return value switch + { + V4TextPromptElementType.Text => "text", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static V4TextPromptElementType? ToEnum(string value) + { + return value switch + { + "text" => V4TextPromptElementType.Text, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwk.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwk.Json.g.cs new file mode 100644 index 0000000..b713552 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwk.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class WebhookSigningJwk + { + /// + /// 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.WebhookSigningJwk? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.WebhookSigningJwk), + jsonSerializerContext) as global::Ideogram.WebhookSigningJwk; + } + + /// + /// 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.WebhookSigningJwk? 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.WebhookSigningJwk), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.WebhookSigningJwk; + } + + /// + /// 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.WebhookSigningJwk.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwk.g.cs new file mode 100644 index 0000000..e1db4f2 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwk.g.cs @@ -0,0 +1,130 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// A single Ed25519 public key. The `x` field carries the 32-byte public
+ /// key as base64url without padding; `kid` matches the
+ /// `X-Ideogram-Webhook-Key-Id` header on outbound webhooks for cache hints,
+ /// but verifiers SHOULD try every key in the set rather than relying on
+ /// `kid` alone.
+ /// Example: {"kty":"OKP","crv":"Ed25519","use":"sig","kid":"v1","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","alg":"EdDSA"} + ///
+ public sealed partial class WebhookSigningJwk + { + /// + /// Key type. Always `"OKP"` for Ed25519.
+ /// Example: OKP + ///
+ /// OKP + [global::System.Text.Json.Serialization.JsonPropertyName("kty")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Kty { get; set; } + + /// + /// Curve. Always `"Ed25519"`.
+ /// Example: Ed25519 + ///
+ /// Ed25519 + [global::System.Text.Json.Serialization.JsonPropertyName("crv")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Crv { get; set; } + + /// + /// The 32-byte public key, base64url-encoded without padding.
+ /// Example: 11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo + ///
+ /// 11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo + [global::System.Text.Json.Serialization.JsonPropertyName("x")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string X { get; set; } + + /// + /// Opaque key identifier; stable across rotations of the same key.
+ /// Example: v1 + ///
+ /// v1 + [global::System.Text.Json.Serialization.JsonPropertyName("kid")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Kid { get; set; } + + /// + /// Always `"EdDSA"`.
+ /// Example: EdDSA + ///
+ /// EdDSA + [global::System.Text.Json.Serialization.JsonPropertyName("alg")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Alg { get; set; } + + /// + /// Always `"sig"` (signing-only).
+ /// Example: sig + ///
+ /// sig + [global::System.Text.Json.Serialization.JsonPropertyName("use")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Use { 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. + /// + /// + /// Key type. Always `"OKP"` for Ed25519.
+ /// Example: OKP + /// + /// + /// Curve. Always `"Ed25519"`.
+ /// Example: Ed25519 + /// + /// + /// The 32-byte public key, base64url-encoded without padding.
+ /// Example: 11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo + /// + /// + /// Opaque key identifier; stable across rotations of the same key.
+ /// Example: v1 + /// + /// + /// Always `"EdDSA"`.
+ /// Example: EdDSA + /// + /// + /// Always `"sig"` (signing-only).
+ /// Example: sig + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public WebhookSigningJwk( + string kty, + string crv, + string x, + string kid, + string alg, + string use) + { + this.Kty = kty ?? throw new global::System.ArgumentNullException(nameof(kty)); + this.Crv = crv ?? throw new global::System.ArgumentNullException(nameof(crv)); + this.X = x ?? throw new global::System.ArgumentNullException(nameof(x)); + this.Kid = kid ?? throw new global::System.ArgumentNullException(nameof(kid)); + this.Alg = alg ?? throw new global::System.ArgumentNullException(nameof(alg)); + this.Use = use ?? throw new global::System.ArgumentNullException(nameof(use)); + } + + /// + /// Initializes a new instance of the class. + /// + public WebhookSigningJwk() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwks.Json.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwks.Json.g.cs new file mode 100644 index 0000000..6fb0759 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwks.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ideogram +{ + public sealed partial class WebhookSigningJwks + { + /// + /// 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.WebhookSigningJwks? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ideogram.WebhookSigningJwks), + jsonSerializerContext) as global::Ideogram.WebhookSigningJwks; + } + + /// + /// 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.WebhookSigningJwks? 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.WebhookSigningJwks), + jsonSerializerContext).ConfigureAwait(false)) as global::Ideogram.WebhookSigningJwks; + } + + /// + /// 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.WebhookSigningJwks.g.cs b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwks.g.cs new file mode 100644 index 0000000..eb0de69 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.Models.WebhookSigningJwks.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// JSON Web Key Set listing the Ed25519 public keys Ideogram uses to sign
+ /// webhook payloads. Each entry follows RFC 7517 conventions for OKP keys.
+ /// Example: {"keys":[{"kty":"OKP","crv":"Ed25519","use":"sig","kid":"v1","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","alg":"EdDSA"},{"kty":"OKP","crv":"Ed25519","use":"sig","kid":"v1","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo","alg":"EdDSA"}]} + ///
+ public sealed partial class WebhookSigningJwks + { + /// + /// Active and recently-rotated signing keys. A webhook is authentic if
+ /// its signature verifies against any key in this list. + ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("keys")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Keys { 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. + /// + /// + /// Active and recently-rotated signing keys. A webhook is authentic if
+ /// its signature verifies against any key in this list. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public WebhookSigningJwks( + global::System.Collections.Generic.IList keys) + { + this.Keys = keys ?? throw new global::System.ArgumentNullException(nameof(keys)); + } + + /// + /// Initializes a new instance of the class. + /// + public WebhookSigningJwks() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.GetCustomModel.g.cs b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.GetCustomModel.g.cs index 1e33076..063be2e 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.GetCustomModel.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.GetCustomModel.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetCustomModelResponseContent( string modelId, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetCustomModelAsResponseAsync( + modelId: modelId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get model details
+ /// Get detailed information about a specific custom model. The user must either own the model or the model must be shared with the user's organization via the model registry. Returns 404 if the model is not found or not accessible. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetCustomModelAsResponseAsync( + string modelId, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetCustomModelResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: $"/models/{modelId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetCustomModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetCustomModelResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetCustomModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessGetCustomModelResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetCustomModelResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetCustomModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetCustomModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetCustomModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -307,17 +347,16 @@ partial void ProcessGetCustomModelResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -340,17 +379,16 @@ partial void ProcessGetCustomModelResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -374,23 +412,25 @@ partial void ProcessGetCustomModelResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.GetModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.GetModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -404,9 +444,13 @@ partial void ProcessGetCustomModelResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.GetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.GetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -423,17 +467,15 @@ partial void ProcessGetCustomModelResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.ListCustomModels.g.cs b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.ListCustomModels.g.cs index c26438b..cc0aa10 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.ListCustomModels.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.ListCustomModels.g.cs @@ -57,6 +57,30 @@ partial void ProcessListCustomModelsResponseContent( global::System.Collections.Generic.IList? status = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListCustomModelsAsResponseAsync( + scope: scope, + status: status, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List models
+ /// Lists custom models for the authenticated user. Use the `scope` parameter to control which models are returned. If omitted, returns both owned models and models shared with the user's organization via the model registry. `owned` returns only models created by the user. `shared` returns only models shared via the model registry, excluding the user's own models. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListCustomModelsAsResponseAsync( + global::Ideogram.ListCustomModelsScope? scope = default, + global::System.Collections.Generic.IList? status = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -87,12 +111,13 @@ partial void ProcessListCustomModelsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/models", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("scope", scope?.ToValueString()) - .AddOptionalParameter("status", status, selector: static x => x.ToValueString(), delimiter: ",", explode: true) + .AddOptionalParameter("status", status, selector: static x => x.ToValueString(), delimiter: ",", explode: true) ; var __path = __pathBuilder.ToString(); __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -165,6 +190,8 @@ partial void ProcessListCustomModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +202,11 @@ partial void ProcessListCustomModelsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +224,8 @@ partial void ProcessListCustomModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +235,7 @@ partial void ProcessListCustomModelsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +244,11 @@ partial void ProcessListCustomModelsResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +265,15 @@ partial void ProcessListCustomModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +313,8 @@ partial void ProcessListCustomModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +335,8 @@ partial void ProcessListCustomModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -317,17 +360,16 @@ partial void ProcessListCustomModelsResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -351,23 +393,25 @@ partial void ProcessListCustomModelsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.ListModelsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.ListModelsResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -381,9 +425,13 @@ partial void ProcessListCustomModelsResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.ListModelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.ListModelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -400,17 +448,15 @@ partial void ProcessListCustomModelsResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3.g.cs b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3.g.cs index c039b63..e605d3d 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3.g.cs @@ -51,6 +51,29 @@ partial void ProcessTrainModelV3ResponseContent( /// public async global::System.Threading.Tasks.Task TrainModelV3Async( + global::Ideogram.TrainModelV3Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TrainModelV3AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Train a custom Ideogram v3 model
+ /// Start training a custom Ideogram v3 model from a dataset using default hyperparameters. The dataset must contain at least 15 images and a maximum of 100 images. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> TrainModelV3AsResponseAsync( + global::Ideogram.TrainModelV3Request request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessTrainModelV3ResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/train-model", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessTrainModelV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessTrainModelV3ResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessTrainModelV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessTrainModelV3ResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessTrainModelV3ResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessTrainModelV3ResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessTrainModelV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessTrainModelV3ResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -316,17 +358,16 @@ partial void ProcessTrainModelV3ResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -349,17 +390,16 @@ partial void ProcessTrainModelV3ResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -382,17 +422,16 @@ partial void ProcessTrainModelV3ResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -416,23 +455,25 @@ partial void ProcessTrainModelV3ResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -446,9 +487,13 @@ partial void ProcessTrainModelV3ResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -465,17 +510,15 @@ partial void ProcessTrainModelV3ResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3Advanced.g.cs b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3Advanced.g.cs index 109e95e..6eb0175 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3Advanced.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.TrainModelV3Advanced.g.cs @@ -51,6 +51,29 @@ partial void ProcessTrainModelV3AdvancedResponseContent( /// public async global::System.Threading.Tasks.Task TrainModelV3AdvancedAsync( + global::Ideogram.TrainModelV3AdvancedRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TrainModelV3AdvancedAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Train a custom Ideogram v3 model with advanced hyperparameters
+ /// Start training a custom Ideogram v3 model from a dataset with caller-supplied hyperparameters (training steps, LoRA rank, EMA decay, learning rate). All hyperparameters are optional and fall back to defaults when omitted. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> TrainModelV3AdvancedAsResponseAsync( + global::Ideogram.TrainModelV3AdvancedRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessTrainModelV3AdvancedResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/v1/ideogram-v3/train-model-advanced", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessTrainModelV3AdvancedResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessTrainModelV3AdvancedResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessTrainModelV3AdvancedResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessTrainModelV3AdvancedResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessTrainModelV3AdvancedResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessTrainModelV3AdvancedResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessTrainModelV3AdvancedResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessTrainModelV3AdvancedResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -316,17 +358,16 @@ partial void ProcessTrainModelV3AdvancedResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -349,17 +390,16 @@ partial void ProcessTrainModelV3AdvancedResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 404) @@ -382,17 +422,16 @@ partial void ProcessTrainModelV3AdvancedResponseContent( __exception_404 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -416,23 +455,25 @@ partial void ProcessTrainModelV3AdvancedResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.TrainDatasetModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -446,9 +487,13 @@ partial void ProcessTrainModelV3AdvancedResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.TrainDatasetModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -465,17 +510,15 @@ partial void ProcessTrainModelV3AdvancedResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } diff --git a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.g.cs index 856d94d..45cde2b 100644 --- a/src/libs/Ideogram/Generated/Ideogram.ModelsClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.ModelsClient.g.cs @@ -62,6 +62,27 @@ public ModelsClient( { } + /// + /// Creates a new instance of the ModelsClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ModelsClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the ModelsClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public ModelsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ModelsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.OptionsSupport.g.cs b/src/libs/Ideogram/Generated/Ideogram.OptionsSupport.g.cs index 3673312..2183d79 100644 --- a/src/libs/Ideogram/Generated/Ideogram.OptionsSupport.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.OptionsSupport.g.cs @@ -54,6 +54,253 @@ public sealed class AutoSDKClientOptions Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook))); return this; } + + /// + /// Optional per-request authorization provider invoked before each request is sent. + /// Set this when the client is registered as a singleton in DI but each call needs + /// a fresh credential resolved from a provider, secret-store, or session — instead + /// of mutating the shared Authorizations list at construction time. + /// + public global::Ideogram.IAutoSDKAuthorizationProvider? AuthorizationProvider { get; set; } + + /// + /// Convenience helper that registers + /// using so request-level auth is resolved without + /// touching shared client state. + /// + /// + public global::Ideogram.AutoSDKClientOptions UseAuthorizationProvider( + global::Ideogram.IAutoSDKAuthorizationProvider provider) + { + AuthorizationProvider = provider ?? throw new global::System.ArgumentNullException(nameof(provider)); + if (Hooks.Find(static x => x is global::Ideogram.AutoSDKAuthorizationProviderHook) == null) + { + Hooks.Add(new global::Ideogram.AutoSDKAuthorizationProviderHook()); + } + + return this; + } + } + + /// + /// A request-level authorization value supplied by . + /// Mirrors the runtime fields the SDK applies for HTTP / OAuth2 / API-key auth without + /// requiring the consumer to construct the generated EndPointAuthorization type. + /// + public readonly struct AutoSDKAuthorizationValue + { + /// + /// Initializes a new . + /// + /// + /// + /// + /// + /// + public AutoSDKAuthorizationValue( + string value, + string scheme = "Bearer", + string? headerName = null, + string location = "Header", + string type = "Http") + { + Value = value ?? string.Empty; + Scheme = string.IsNullOrWhiteSpace(scheme) ? "Bearer" : scheme; + HeaderName = headerName ?? string.Empty; + Location = string.IsNullOrWhiteSpace(location) ? "Header" : location; + Type = string.IsNullOrWhiteSpace(type) ? "Http" : type; + } + + /// The credential value (token, API key, etc.). + public string Value { get; } + + /// The HTTP authorization scheme — typically Bearer, Basic, or Token. + public string Scheme { get; } + + /// The custom header name when is ApiKey; ignored for HTTP/OAuth2 auth. + public string HeaderName { get; } + + /// The credential location — Header, Query, or Cookie. + public string Location { get; } + + /// The auth type — Http, OAuth2, OpenIdConnect, or ApiKey. + public string Type { get; } + + /// Convenience factory for a Bearer token. + public static global::Ideogram.AutoSDKAuthorizationValue Bearer(string token) => new(value: token, scheme: "Bearer"); + + /// Convenience factory for an API-key header. + public static global::Ideogram.AutoSDKAuthorizationValue ApiKeyHeader(string name, string value) => + new(value: value, headerName: name, location: "Header", type: "ApiKey"); + } + + /// + /// Resolves request-level authorization values without mutating the shared client + /// authorization list. Implementations should be safe to invoke concurrently — + /// the hook calls them once per outgoing request. + /// + public interface IAutoSDKAuthorizationProvider + { + /// + /// Returns one or more values to apply to + /// the current request, or an empty list / null to leave the request as-is. + /// + /// + global::System.Threading.Tasks.Task?> ResolveAsync( + global::Ideogram.AutoSDKHookContext context); + } + + /// + /// Marker keys stamped onto outgoing + /// instances so consumer s — and any + /// other transport-layer code that runs after AutoSDK's send pipeline — can observe whether + /// the resolved Authorization is call-scoped and opt out of overwriting it with a + /// rotation-aware account-level credential. + /// + public static class AutoSDKHttpRequestOptions + { + /// + /// Key under which records the marker. Exposed + /// for handlers that target frameworks older than .NET 5 and need to read the value + /// through the legacy HttpRequestMessage.Properties bag. + /// + public const string AuthorizationOverrideKey = "AutoSDK.AuthorizationOverride"; + +#if NET5_0_OR_GREATER + /// + /// Strongly-typed for + /// the call-scoped Authorization marker on .NET 5+ targets. Consumers should prefer this + /// over the legacy HttpRequestMessage.Properties bag where available. + /// + public static readonly global::System.Net.Http.HttpRequestOptionsKey AuthorizationOverride = + new global::System.Net.Http.HttpRequestOptionsKey(AuthorizationOverrideKey); +#endif + + /// + /// Stamps the call-scoped Authorization marker on . AutoSDK's + /// built-in calls this whenever the + /// resolved auth came from a per-request override or a client-level + /// . Hand-written SDK extensions that set a + /// non-default Authorization header (e.g. a session-scoped bearer returned by an + /// upstream poll) should call this too so downstream rotation handlers know to skip the + /// overwrite. + /// + /// + public static void StampAuthorizationOverride( + global::System.Net.Http.HttpRequestMessage? request) + { + if (request is null) + { + return; + } + +#if NET5_0_OR_GREATER + request.Options.Set(AuthorizationOverride, true); +#else +#pragma warning disable CS0618 // HttpRequestMessage.Properties is obsolete in NET5+, but the only option below it. + request.Properties[AuthorizationOverrideKey] = true; +#pragma warning restore CS0618 +#endif + } + + /// + /// Returns true when previously marked the + /// request as carrying a call-scoped Authorization. + /// + /// + public static bool HasAuthorizationOverride( + global::System.Net.Http.HttpRequestMessage? request) + { + if (request is null) + { + return false; + } + +#if NET5_0_OR_GREATER + return request.Options.TryGetValue(AuthorizationOverride, out var value) && value; +#else +#pragma warning disable CS0618 + return request.Properties.TryGetValue(AuthorizationOverrideKey, out var raw) && + raw is bool flag && + flag; +#pragma warning restore CS0618 +#endif + } + } + + /// + /// Built-in that consults + /// before every outgoing + /// request and stamps the resolved values onto the . + /// + public sealed class AutoSDKAuthorizationProviderHook : global::Ideogram.AutoSDKHook + { + /// + public override async global::System.Threading.Tasks.Task OnBeforeRequestAsync( + global::Ideogram.AutoSDKHookContext context) + { + context = context ?? throw new global::System.ArgumentNullException(nameof(context)); + + if (context.Request == null) + { + return; + } + + var perRequest = context.RequestOptions?.Authorizations; + if (perRequest != null && perRequest.Count > 0) + { + for (var index = 0; index < perRequest.Count; index++) + { + ApplyAuthorization(context.Request, perRequest[index]); + } + + global::Ideogram.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); + return; + } + + var provider = context.ClientOptions?.AuthorizationProvider; + if (provider == null) + { + return; + } + + var resolved = await provider.ResolveAsync(context).ConfigureAwait(false); + if (resolved == null || resolved.Count == 0) + { + return; + } + + for (var index = 0; index < resolved.Count; index++) + { + ApplyAuthorization(context.Request, resolved[index]); + } + + global::Ideogram.AutoSDKHttpRequestOptions.StampAuthorizationOverride(context.Request); + } + + private static void ApplyAuthorization( + global::System.Net.Http.HttpRequestMessage request, + global::Ideogram.AutoSDKAuthorizationValue authorization) + { + switch (authorization.Type) + { + case "Http": + case "OAuth2": + case "OpenIdConnect": + request.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: authorization.Scheme, + parameter: authorization.Value); + break; + case "ApiKey": + if (string.Equals(authorization.Location, "Header", global::System.StringComparison.OrdinalIgnoreCase) && + !string.IsNullOrEmpty(authorization.HeaderName)) + { + request.Headers.Remove(authorization.HeaderName); + request.Headers.TryAddWithoutValidation(authorization.HeaderName, authorization.Value ?? string.Empty); + } + break; + } + } } /// @@ -87,6 +334,15 @@ public sealed class AutoSDKRequestOptions /// Overrides response buffering for this request when set. /// public bool? ReadResponseAsString { get; set; } + + /// + /// Optional per-request authorization values. When non-empty, the built-in + /// applies these instead of consulting + /// for this request only. + /// Useful for multi-tenant routing or "act-as" admin tooling that needs a different + /// credential per call without mutating shared client state. + /// + public global::System.Collections.Generic.IReadOnlyList? Authorizations { get; set; } } /// @@ -101,9 +357,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +523,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +556,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::Ideogram.AutoSDKHookContext @@ -271,6 +575,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +644,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::Ideogram.AutoSDKClientOptions clientOptions, global::Ideogram.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Ideogram.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::Ideogram.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPrompt.g.cs b/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPrompt.g.cs index 8d4601a..0529366 100644 --- a/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPrompt.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPrompt.g.cs @@ -51,6 +51,29 @@ partial void ProcessPostMagicPromptResponseContent( /// public async global::System.Threading.Tasks.Task PostMagicPromptAsync( + global::Ideogram.MagicPromptRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostMagicPromptAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate Magic Prompt
+ /// Transforms basic prompts into a magic prompt. Internal use only (feature flagged). TODO: update description if enabled externally. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostMagicPromptAsResponseAsync( + global::Ideogram.MagicPromptRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -81,10 +104,11 @@ partial void ProcessPostMagicPromptResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/magic-prompt", baseUri: HttpClient.BaseAddress); @@ -117,30 +141,40 @@ partial void ProcessPostMagicPromptResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); - __httpRequestContent.Add( - content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), - name: "\"prompt\""); + if (request.Prompt != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.MagicPromptVersion.ToValueString()), name: "\"magic_prompt_version\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.ClassifyPromptCategory, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"classify_prompt_category\""); + if (request.StyleType != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.StyleType).HasValue ? (request.StyleType).GetValueOrDefault().ToValueString() : string.Empty), name: "\"style_type\""); - } + + } if (request.Seed != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Seed, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"seed\""); - } + + } if (request.CharacterReferenceImages != default) { @@ -157,15 +191,107 @@ partial void ProcessPostMagicPromptResponseContent( __contentCharacterReferenceImages.Headers.ContentDisposition.FileNameStar = null; } } - } + + } if (request.SystemPrompt != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.SystemPrompt ?? string.Empty), name: "\"system_prompt\""); + + } + if (request.AspectRatio != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.AspectRatio).HasValue ? (request.AspectRatio).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"aspect_ratio\""); + + } + if (request.Temperature != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"temperature\""); + + } + if (request.TopP != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.TopP, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"top_p\""); + + } + if (request.TopK != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.TopK, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"top_k\""); + + } + if (request.MinP != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.MinP, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"min_p\""); + + } + if (request.MaxTokens != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.MaxTokens, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"max_tokens\""); + + } + if (request.PresencePenalty != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PresencePenalty, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"presence_penalty\""); + + } + if (request.FrequencyPenalty != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.FrequencyPenalty, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"frequency_penalty\""); + + } + if (request.RepetitionPenalty != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.RepetitionPenalty, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"repetition_penalty\""); + } + if (request.Checkpoint != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Checkpoint ?? string.Empty), + name: "\"checkpoint\""); + + } + if (request.Messages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Messages, x => x.ToJson(JsonSerializerContext)))}]"), + name: "\"messages\""); + + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -207,6 +333,8 @@ partial void ProcessPostMagicPromptResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -217,6 +345,11 @@ partial void ProcessPostMagicPromptResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -234,6 +367,8 @@ partial void ProcessPostMagicPromptResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -243,8 +378,7 @@ partial void ProcessPostMagicPromptResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -253,6 +387,11 @@ partial void ProcessPostMagicPromptResponseContent( __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -269,14 +408,15 @@ partial void ProcessPostMagicPromptResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -316,6 +456,8 @@ partial void ProcessPostMagicPromptResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -336,6 +478,8 @@ partial void ProcessPostMagicPromptResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -359,17 +503,16 @@ partial void ProcessPostMagicPromptResponseContent( __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 401) @@ -392,17 +535,16 @@ partial void ProcessPostMagicPromptResponseContent( __exception_401 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -425,17 +567,16 @@ partial void ProcessPostMagicPromptResponseContent( __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 500) @@ -458,17 +599,16 @@ partial void ProcessPostMagicPromptResponseContent( __exception_500 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -492,23 +632,25 @@ partial void ProcessPostMagicPromptResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.MagicPromptResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.MagicPromptResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -522,9 +664,13 @@ partial void ProcessPostMagicPromptResponseContent( #endif ).ConfigureAwait(false); - return - await global::Ideogram.MagicPromptResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.MagicPromptResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -541,17 +687,15 @@ partial void ProcessPostMagicPromptResponseContent( { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -567,7 +711,8 @@ partial void ProcessPostMagicPromptResponseContent( /// Transforms basic prompts into a magic prompt. Internal use only (feature flagged). TODO: update description if enabled externally. ///
/// - /// The prompt to enhance with a magic prompt
+ /// The prompt to enhance with a magic prompt. Mutually
+ /// exclusive with `messages`; one of the two must be set.
/// Example: a cat /// /// @@ -595,17 +740,79 @@ partial void ProcessPostMagicPromptResponseContent( /// A system prompt to use for the magic prompt.
/// Example: You are a helpful assistant that generates magic prompts for images. /// + /// + /// Optional target aspect ratio used to condition the generated
+ /// magic prompt's framing. Forwarded to the autoprompt pipeline
+ /// so registry-driven system prompts that interpolate
+ /// `` see the bucket the caller intends. + /// + /// + /// Sampling temperature override. Defaults to the trainer-conditioned
+ /// value when omitted (0.7 for V4_QWEN_3_5_27B). Only honored with
+ /// V4 magic-prompt versions; supplying it with another version
+ /// returns 400. + /// + /// + /// Nucleus-sampling top_p override. Only honored with V4 versions. + /// + /// + /// Top-k sampling override. Only honored with V4 versions. + /// + /// + /// min_p sampling override. Only honored with V4 versions. + /// + /// + /// Cap on the number of tokens the model may generate. Defaults to
+ /// 4096 (the trainer's reference cap) when omitted. Only honored
+ /// with V4 versions. + /// + /// + /// Presence-penalty override. Only honored with V4 versions. + /// + /// + /// Frequency-penalty override. Only honored with V4 versions. + /// + /// + /// Repetition-penalty override. Only honored with V4 versions. + /// + /// + /// Optional override of the LoRA adapter the V4 magic-prompt
+ /// wrapper downloads and runs. Pass a `gs://` URI pointing at a
+ /// checkpoint directory containing `adapter_config.json`. When
+ /// omitted, the wrapper-preloaded production checkpoint is used.
+ /// Honored with the wrapper-routed LoRA versions
+ /// `V4_QWEN_3_5_27B` and `V4_QWEN_3_5_27B_FULL_FINETUNE_LORA`;
+ /// supplying it with `V4_QWEN_3_5_27B_PREFUSED` or
+ /// `V4_QWEN_3_5_27B_FULL_FINETUNE` (which serve fixed weights and
+ /// cannot swap adapters per request) or any other version returns
+ /// 400. + /// + /// + /// Pre-formed chat messages forwarded verbatim to V4. Mutually
+ /// exclusive with `prompt`; exactly one must be set. V4 only. + /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// public async global::System.Threading.Tasks.Task PostMagicPromptAsync( - string prompt, global::Ideogram.MagicPromptVersionEnum magicPromptVersion, bool classifyPromptCategory, + string? prompt = default, global::Ideogram.StyleTypeV3? styleType = default, int? seed = default, global::System.Collections.Generic.IList? characterReferenceImages = default, string? systemPrompt = default, + global::Ideogram.AspectRatioV3? aspectRatio = default, + float? temperature = default, + float? topP = default, + int? topK = default, + float? minP = default, + int? maxTokens = default, + float? presencePenalty = default, + float? frequencyPenalty = default, + float? repetitionPenalty = default, + string? checkpoint = default, + global::System.Collections.Generic.IList? messages = default, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) { @@ -618,6 +825,17 @@ partial void ProcessPostMagicPromptResponseContent( Seed = seed, CharacterReferenceImages = characterReferenceImages, SystemPrompt = systemPrompt, + AspectRatio = aspectRatio, + Temperature = temperature, + TopP = topP, + TopK = topK, + MinP = minP, + MaxTokens = maxTokens, + PresencePenalty = presencePenalty, + FrequencyPenalty = frequencyPenalty, + RepetitionPenalty = repetitionPenalty, + Checkpoint = checkpoint, + Messages = messages, }; return await PostMagicPromptAsync( diff --git a/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPromptV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPromptV4.g.cs new file mode 100644 index 0000000..df22a4a --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.PromptClient.PostMagicPromptV4.g.cs @@ -0,0 +1,608 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class PromptClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostMagicPromptV4SecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostMagicPromptV4SecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostMagicPromptV4SecurityRequirement0, + }; + partial void PreparePostMagicPromptV4Arguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.MagicPromptV4Request request); + partial void PreparePostMagicPromptV4Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.MagicPromptV4Request request); + partial void ProcessPostMagicPromptV4Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostMagicPromptV4ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostMagicPromptV4Async( + + global::Ideogram.MagicPromptV4Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostMagicPromptV4AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostMagicPromptV4AsResponseAsync( + + global::Ideogram.MagicPromptV4Request request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostMagicPromptV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostMagicPromptV4SecurityRequirements, + operationName: "PostMagicPromptV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/magic-prompt", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostMagicPromptV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostMagicPromptV4", + methodName: "PostMagicPromptV4Async", + pathTemplate: "\"/v1/ideogram-v4/magic-prompt\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostMagicPromptV4", + methodName: "PostMagicPromptV4Async", + pathTemplate: "\"/v1/ideogram-v4/magic-prompt\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostMagicPromptV4", + methodName: "PostMagicPromptV4Async", + pathTemplate: "\"/v1/ideogram-v4/magic-prompt\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostMagicPromptV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostMagicPromptV4", + methodName: "PostMagicPromptV4Async", + pathTemplate: "\"/v1/ideogram-v4/magic-prompt\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostMagicPromptV4", + methodName: "PostMagicPromptV4Async", + pathTemplate: "\"/v1/ideogram-v4/magic-prompt\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostMagicPromptV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.MagicPromptV4Response.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.MagicPromptV4Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Generate a Magic Prompt with Ideogram 4.0
+ /// Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.
+ /// The magic prompt model version is fixed; callers cannot select it.
+ /// When `aspect_ratio` is `AUTO` (the default), the model selects the most
+ /// suitable aspect ratio for the prompt and returns it in the response. + ///
+ /// + /// The natural-language prompt to enhance into an Ideogram 4.0 magic
+ /// prompt. Named `text_prompt` to match the Ideogram 4.0 generate
+ /// request surface.
+ /// Example: a cat + /// + /// + /// Target aspect ratio. Defaults to `AUTO`, which lets the model
+ /// select the most suitable ratio and return it in the response. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostMagicPromptV4Async( + string textPrompt, + global::Ideogram.AspectRatioV4? aspectRatio = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.MagicPromptV4Request + { + TextPrompt = textPrompt, + AspectRatio = aspectRatio, + }; + + return await PostMagicPromptV4Async( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.PromptClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.PromptClient.g.cs index 343b26a..0ed4326 100644 --- a/src/libs/Ideogram/Generated/Ideogram.PromptClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.PromptClient.g.cs @@ -61,6 +61,27 @@ public PromptClient( { } + /// + /// Creates a new instance of the PromptClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public PromptClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the PromptClient. /// If no httpClient is provided, a new one will be created. @@ -72,10 +93,10 @@ public PromptClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public PromptClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribe.g.cs b/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribe.g.cs index f351933..726ac15 100644 --- a/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribe.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribe.g.cs @@ -52,6 +52,30 @@ partial void ProcessPostDescribeResponseContent( /// public async global::System.Threading.Tasks.Task PostDescribeAsync( + global::Ideogram.DescribeRequest request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostDescribeAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostDescribeAsResponseAsync( + global::Ideogram.DescribeRequest request, global::Ideogram.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -82,10 +106,11 @@ partial void ProcessPostDescribeResponseContent( var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( clientOptions: Options, requestOptions: requestOptions, - supportsRetry: true); + supportsRetry: false); global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Ideogram.PathBuilder( path: "/describe", baseUri: HttpClient.BaseAddress); @@ -118,6 +143,7 @@ partial void ProcessPostDescribeResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -156,14 +182,18 @@ request.ImageFilename is null { __contentImageFile.Headers.ContentDisposition.FileNameStar = null; } + if (request.DescribeModelVersion != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.DescribeModelVersion).HasValue ? (request.DescribeModelVersion).GetValueOrDefault().ToValueString() : string.Empty), name: "\"describe_model_version\""); + } + __httpRequest.Content = __httpRequestContent; + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -205,6 +235,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -215,6 +247,11 @@ request.ImageFilename is null } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -232,6 +269,8 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -241,8 +280,7 @@ request.ImageFilename is null __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -251,6 +289,11 @@ request.ImageFilename is null __attempt < __maxAttempts && global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -267,14 +310,15 @@ request.ImageFilename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -314,6 +358,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -334,6 +380,8 @@ request.ImageFilename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // @@ -357,17 +405,16 @@ request.ImageFilename is null __exception_400 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Image failed the safety check. if ((int)__response.StatusCode == 422) @@ -394,18 +441,17 @@ request.ImageFilename is null __exception_422 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 429) @@ -428,17 +474,16 @@ request.ImageFilename is null __exception_429 = __ex; } - throw new global::Ideogram.ApiException( + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_429, - statusCode: __response.StatusCode) - { - ResponseBody = __content_429, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -462,23 +507,25 @@ request.ImageFilename is null { __response.EnsureSuccessStatusCode(); - return - global::Ideogram.DescribeResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Ideogram.DescribeResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -492,9 +539,13 @@ request.ImageFilename is null #endif ).ConfigureAwait(false); - return - await global::Ideogram.DescribeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Ideogram.DescribeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -511,17 +562,15 @@ request.ImageFilename is null { } - throw new global::Ideogram.ApiException( + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } @@ -569,5 +618,1062 @@ request.ImageFilename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The model version to use for describing images. Defaults to V_3.
+ /// Default Value: V_3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostDescribeAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.DescribeModelVersion? describeModelVersion = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.DescribeRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + DescribeModelVersion = describeModelVersion, + }; + PrepareArguments( + client: HttpClient); + PreparePostDescribeArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostDescribeSecurityRequirements, + operationName: "PostDescribeAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/describe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.DescribeModelVersion != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.DescribeModelVersion).HasValue ? (request.DescribeModelVersion).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"describe_model_version\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostDescribeRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostDescribeResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Image failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.ImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostDescribeResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.DescribeResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.DescribeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Describe
+ /// Describe an image.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// The model version to use for describing images. Defaults to V_3.
+ /// Default Value: V_3 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostDescribeAsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + global::Ideogram.DescribeModelVersion? describeModelVersion = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.DescribeRequest + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + DescribeModelVersion = describeModelVersion, + }; + PrepareArguments( + client: HttpClient); + PreparePostDescribeArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostDescribeSecurityRequirements, + operationName: "PostDescribeAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/describe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.DescribeModelVersion != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.DescribeModelVersion).HasValue ? (request.DescribeModelVersion).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"describe_model_version\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostDescribeRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostDescribeResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribe", + methodName: "PostDescribeAsync", + pathTemplate: "\"/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Image failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.ImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostDescribeResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.DescribeResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.DescribeResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } } } \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribeV4.g.cs b/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribeV4.g.cs new file mode 100644 index 0000000..fa15170 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.VisionClient.PostDescribeV4.g.cs @@ -0,0 +1,1901 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class VisionClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_PostDescribeV4SecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_PostDescribeV4SecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_PostDescribeV4SecurityRequirement0, + }; + partial void PreparePostDescribeV4Arguments( + global::System.Net.Http.HttpClient httpClient, + global::Ideogram.DescribeRequestV4 request); + partial void PreparePostDescribeV4Request( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ideogram.DescribeRequestV4 request); + partial void ProcessPostDescribeV4Response( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPostDescribeV4ResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostDescribeV4Async( + + global::Ideogram.DescribeRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PostDescribeV4AsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostDescribeV4AsResponseAsync( + + global::Ideogram.DescribeRequestV4 request, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePostDescribeV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostDescribeV4SecurityRequirements, + operationName: "PostDescribeV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/describe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.ByteArrayContent(request.ImageFile ?? global::System.Array.Empty()); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.IncludeBbox != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeBbox, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_bbox\""); + + } + if (request.IncludeStyleDescriptions != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeStyleDescriptions, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_style_descriptions\""); + + } + if (request.IncludeTags != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeTags, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_tags\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostDescribeV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostDescribeV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Image failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.ImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostDescribeV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.DescribeResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.DescribeResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostDescribeV4Async( + byte[] imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Ideogram.DescribeRequestV4 + { + ImageFile = imageFile, + ImageFilename = imageFilename, + IncludeBbox = includeBbox, + IncludeStyleDescriptions = includeStyleDescriptions, + IncludeTags = includeTags, + }; + + return await PostDescribeV4Async( + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PostDescribeV4Async( + global::System.IO.Stream imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.DescribeRequestV4 + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + IncludeBbox = includeBbox, + IncludeStyleDescriptions = includeStyleDescriptions, + IncludeTags = includeTags, + }; + PrepareArguments( + client: HttpClient); + PreparePostDescribeV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostDescribeV4SecurityRequirements, + operationName: "PostDescribeV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/describe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.IncludeBbox != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeBbox, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_bbox\""); + + } + if (request.IncludeStyleDescriptions != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeStyleDescriptions, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_style_descriptions\""); + + } + if (request.IncludeTags != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeTags, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_tags\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostDescribeV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostDescribeV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Image failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.ImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostDescribeV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::Ideogram.DescribeResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return + await global::Ideogram.DescribeResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Describe with Ideogram 4.0
+ /// Describe an image with Ideogram 4.0 and return a structured
+ /// `V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt
+ /// that can be passed directly as `json_prompt` to the
+ /// `/v1/ideogram-v4/generate` family of endpoints.
+ /// Supported image formats include JPEG, PNG, and WebP. + ///
+ /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time. + /// + /// + /// When true (default), the response preserves bounding boxes on each
+ /// element so the prompt can be pasted into `/v1/ideogram-v4/generate`
+ /// as `json_prompt` and reproduce the source layout. Set to false to
+ /// drop bounding boxes and let the sampler place elements freely.
+ /// Default Value: true + /// + /// + /// When false (default), the response omits `json_prompt.style_description`
+ /// to match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's source-image style
+ /// description in the response.
+ /// Default Value: false + /// + /// + /// When false (default), the response omits `json_prompt.tags` to match
+ /// the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`
+ /// input. Set to true to surface the captioner's free-form tags on the
+ /// response.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PostDescribeV4AsResponseAsync( + global::System.IO.Stream imageFile, + string imageFilename, + bool? includeBbox = default, + bool? includeStyleDescriptions = default, + bool? includeTags = default, + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + imageFile = imageFile ?? throw new global::System.ArgumentNullException(nameof(imageFile)); + var request = new global::Ideogram.DescribeRequestV4 + { + ImageFile = global::System.Array.Empty(), + ImageFilename = imageFilename, + IncludeBbox = includeBbox, + IncludeStyleDescriptions = includeStyleDescriptions, + IncludeTags = includeTags, + }; + PrepareArguments( + client: HttpClient); + PreparePostDescribeV4Arguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PostDescribeV4SecurityRequirements, + operationName: "PostDescribeV4Async"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: false); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/ideogram-v4/describe", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + 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" || + __authorization.Type == "OpenIdConnect") + { + __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 __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); + var __contentImageFile = new global::System.Net.Http.StreamContent(imageFile); + __contentImageFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.ImageFilename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.ImageFilename) ?? 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: __contentImageFile, + name: "\"image_file\"", + fileName: request.ImageFilename != null ? $"\"{request.ImageFilename}\"" : string.Empty); + if (__contentImageFile.Headers.ContentDisposition != null) + { + __contentImageFile.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.IncludeBbox != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeBbox, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_bbox\""); + + } + if (request.IncludeStyleDescriptions != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeStyleDescriptions, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_style_descriptions\""); + + } + if (request.IncludeTags != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.IncludeTags, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), + name: "\"include_tags\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePostDescribeV4Request( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPostDescribeV4Response( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PostDescribeV4", + methodName: "PostDescribeV4Async", + pathTemplate: "\"/v1/ideogram-v4/describe\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Image failed the safety check. + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::System.Exception? __exception_422 = null; + global::Ideogram.ImageSafetyError? __value_422 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + else + { + __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_422 = global::Ideogram.ImageSafetyError.FromJson(__content_422, JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_422 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_422, + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // + if ((int)__response.StatusCode == 503) + { + string? __content_503 = null; + global::System.Exception? __exception_503 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_503 = __ex; + } + + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_503 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_503, + responseBody: __content_503, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPostDescribeV4ResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.DescribeResponseV4.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.DescribeResponseV4.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.VisionClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.VisionClient.g.cs index af92e48..4f24aea 100644 --- a/src/libs/Ideogram/Generated/Ideogram.VisionClient.g.cs +++ b/src/libs/Ideogram/Generated/Ideogram.VisionClient.g.cs @@ -62,6 +62,27 @@ public VisionClient( { } + /// + /// Creates a new instance of the VisionClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public VisionClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + /// /// Creates a new instance of the VisionClient. /// If no httpClient is provided, a new one will be created. @@ -73,10 +94,10 @@ public VisionClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public VisionClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Ideogram.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.GetWebhookSigningJwks.g.cs b/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.GetWebhookSigningJwks.g.cs new file mode 100644 index 0000000..169e208 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.GetWebhookSigningJwks.g.cs @@ -0,0 +1,435 @@ + +#nullable enable + +namespace Ideogram +{ + public partial class WebhooksClient + { + + + private static readonly global::Ideogram.EndPointSecurityRequirement s_GetWebhookSigningJwksSecurityRequirement0 = + new global::Ideogram.EndPointSecurityRequirement + { + Authorizations = new global::Ideogram.EndPointAuthorizationRequirement[] + { new global::Ideogram.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Ideogram.EndPointSecurityRequirement[] s_GetWebhookSigningJwksSecurityRequirements = + new global::Ideogram.EndPointSecurityRequirement[] + { s_GetWebhookSigningJwksSecurityRequirement0, + }; + partial void PrepareGetWebhookSigningJwksArguments( + global::System.Net.Http.HttpClient httpClient); + partial void PrepareGetWebhookSigningJwksRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage); + partial void ProcessGetWebhookSigningJwksResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetWebhookSigningJwksResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get the public keys used to verify webhook signatures
+ /// Returns the set of Ed25519 public keys Ideogram uses to sign outbound
+ /// webhook payloads. Customers verify incoming webhooks by recomputing the
+ /// canonical signed message (`request_id\nuser_id\ntimestamp\nsha256_hex(body)`)
+ /// and checking the `X-Ideogram-Webhook-Signature` header against any key
+ /// in this document.
+ /// The document includes the current signing key plus any keys recently
+ /// rotated out, so signatures already in flight remain verifiable across
+ /// rotations. Cache for up to 24 hours; refresh sooner if a signature
+ /// fails to verify against the cached set.
+ /// This endpoint is public and unauthenticated — no API key is required. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetWebhookSigningJwksAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetWebhookSigningJwksAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get the public keys used to verify webhook signatures
+ /// Returns the set of Ed25519 public keys Ideogram uses to sign outbound
+ /// webhook payloads. Customers verify incoming webhooks by recomputing the
+ /// canonical signed message (`request_id\nuser_id\ntimestamp\nsha256_hex(body)`)
+ /// and checking the `X-Ideogram-Webhook-Signature` header against any key
+ /// in this document.
+ /// The document includes the current signing key plus any keys recently
+ /// rotated out, so signatures already in flight remain verifiable across
+ /// rotations. Cache for up to 24 hours; refresh sooner if a signature
+ /// fails to verify against the cached set.
+ /// This endpoint is public and unauthenticated — no API key is required. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetWebhookSigningJwksAsResponseAsync( + global::Ideogram.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetWebhookSigningJwksArguments( + httpClient: HttpClient); + + + var __authorizations = global::Ideogram.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetWebhookSigningJwksSecurityRequirements, + operationName: "GetWebhookSigningJwksAsync"); + + using var __timeoutCancellationTokenSource = global::Ideogram.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ideogram.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ideogram.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ideogram.PathBuilder( + path: "/v1/.well-known/jwks.json", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ideogram.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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" || + __authorization.Type == "OpenIdConnect") + { + __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); + } + } + global::Ideogram.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetWebhookSigningJwksRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookSigningJwks", + methodName: "GetWebhookSigningJwksAsync", + pathTemplate: "\"/v1/.well-known/jwks.json\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookSigningJwks", + methodName: "GetWebhookSigningJwksAsync", + pathTemplate: "\"/v1/.well-known/jwks.json\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookSigningJwks", + methodName: "GetWebhookSigningJwksAsync", + pathTemplate: "\"/v1/.well-known/jwks.json\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetWebhookSigningJwksResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookSigningJwks", + methodName: "GetWebhookSigningJwksAsync", + pathTemplate: "\"/v1/.well-known/jwks.json\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetWebhookSigningJwks", + methodName: "GetWebhookSigningJwksAsync", + pathTemplate: "\"/v1/.well-known/jwks.json\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetWebhookSigningJwksResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Ideogram.WebhookSigningJwks.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Ideogram.WebhookSigningJwks.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Ideogram.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Ideogram.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.g.cs b/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.g.cs new file mode 100644 index 0000000..9b70f73 --- /dev/null +++ b/src/libs/Ideogram/Generated/Ideogram.WebhooksClient.g.cs @@ -0,0 +1,139 @@ + +#nullable enable + +namespace Ideogram +{ + /// + /// Endpoints related to webhook delivery and verification. The JWKS
+ /// endpoint publishes the Ed25519 public keys customers use to verify
+ /// that an inbound webhook genuinely originated from Ideogram.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public sealed partial class WebhooksClient : global::Ideogram.IWebhooksClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.ideogram.ai/"; + + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + + /// + public global::Ideogram.AutoSDKClientOptions Options { get; } + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ideogram.SourceGenerationContext.Default; + + + /// + /// Creates a new instance of the WebhooksClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. + public WebhooksClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the WebhooksClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public WebhooksClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the WebhooksClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public WebhooksClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Ideogram.AutoSDKClientOptions? options, + bool disposeHttpClient = true) + { + + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::Ideogram.AutoSDKClientOptions(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Ideogram/Generated/autosdk.generated-examples.json b/src/libs/Ideogram/Generated/autosdk.generated-examples.json index 0f7e3c6..c9a248e 100644 --- a/src/libs/Ideogram/Generated/autosdk.generated-examples.json +++ b/src/libs/Ideogram/Generated/autosdk.generated-examples.json @@ -17,7 +17,7 @@ "Slug": "post-batch", "Description": "Runs automated evaluation of multiple LLM models and system prompts for magic prompt generation. \nGenerates images using large batches of user prompt inputs. Internal use only (feature flagged).", "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.InternalBatchRequest\u003E(\n @\u0022{\n \u0022\u0022user_prompts\u0022\u0022: [\n \u0022\u0022a cat\u0022\u0022,\n \u0022\u0022a dog\u0022\u0022\n ],\n \u0022\u0022sampling_request_params\u0022\u0022: {\n \u0022\u0022aspect_ratio\u0022\u0022: \u0022\u00221x1\u0022\u0022,\n \u0022\u0022style_type\u0022\u0022: \u0022\u0022GENERAL\u0022\u0022,\n \u0022\u0022magic_prompt_version\u0022\u0022: \u0022\u0022V_0\u0022\u0022,\n \u0022\u0022seed\u0022\u0022: 12345,\n \u0022\u0022negative_prompt\u0022\u0022: \u0022\u0022brush strokes, painting\u0022\u0022,\n \u0022\u0022magic_prompt_option\u0022\u0022: \u0022\u0022ON\u0022\u0022,\n \u0022\u0022model\u0022\u0022: \u0022\u0022V_2_TURBO\u0022\u0022,\n \u0022\u0022resolution\u0022\u0022: \u0022\u00221280x800\u0022\u0022,\n \u0022\u0022num_images\u0022\u0022: 1,\n \u0022\u0022color_palette\u0022\u0022: {\n \u0022\u0022name\u0022\u0022: \u0022\u0022PASTEL\u0022\u0022\n }\n },\n \u0022\u0022experiment_variant\u0022\u0022: \u0022\u0022MAGIC_PROMPT_NO_TEXT\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Batch.PostBatchAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022job_id\u0022: \u0022job_id\u0022\n// }", + "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.InternalBatchRequest\u003E(\n @\u0022{\n \u0022\u0022user_prompts\u0022\u0022: [\n \u0022\u0022a cat\u0022\u0022,\n \u0022\u0022a dog\u0022\u0022\n ],\n \u0022\u0022sampling_request_params\u0022\u0022: {\n \u0022\u0022magic_prompt_system_prompt_config_id\u0022\u0022: \u0022\u0022magic_prompt_system_prompt_config_id\u0022\u0022,\n \u0022\u0022aspect_ratio\u0022\u0022: \u0022\u00221x1\u0022\u0022,\n \u0022\u0022style_type\u0022\u0022: \u0022\u0022GENERAL\u0022\u0022,\n \u0022\u0022magic_prompt_version\u0022\u0022: \u0022\u0022V_0\u0022\u0022,\n \u0022\u0022seed\u0022\u0022: 12345,\n \u0022\u0022negative_prompt\u0022\u0022: \u0022\u0022brush strokes, painting\u0022\u0022,\n \u0022\u0022magic_prompt_option\u0022\u0022: \u0022\u0022ON\u0022\u0022,\n \u0022\u0022model\u0022\u0022: \u0022\u0022V_2_TURBO\u0022\u0022,\n \u0022\u0022resolution\u0022\u0022: \u0022\u00221280x800\u0022\u0022,\n \u0022\u0022num_images\u0022\u0022: 1,\n \u0022\u0022color_palette\u0022\u0022: {\n \u0022\u0022name\u0022\u0022: \u0022\u0022PASTEL\u0022\u0022\n }\n },\n \u0022\u0022experiment_variant\u0022\u0022: \u0022\u0022MAGIC_PROMPT_NO_TEXT\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Batch.PostBatchAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022job_id\u0022: \u0022job_id\u0022\n// }", "Format": "sdk", "OperationId": "post_batch", "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." @@ -79,24 +79,24 @@ }, { "Order": 8, - "Title": "Edit (legacy)", - "Slug": "post-edit-image", - "Description": "Edit a given image synchronously using the provided mask. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style type can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Title": "Poll a generation", + "Slug": "get-generation", + "Description": "Retrieves the current status of an asynchronous generation, and its results once complete. Use the \u0060generation_id\u0060 returned by the async generation endpoint.", "Language": "http", - "Code": "### Edit (legacy)\n# @name post_edit_image\nPOST {{host}}/edit\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Image edits generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt or Initial Image failed the safety checks.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Poll a generation\n# @name get_generation\nGET {{host}}/v1/generations/{{generation_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Generation status retrieved successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid request ID provided.\n# 401\n# Description: Not authorized.\n# 404\n# Description: Request not found.\n# 429\n# Description: Too many requests.", "Format": "http", - "OperationId": "post_edit_image", + "OperationId": "get_generation", "Setup": null }, { "Order": 9, - "Title": "Edit with Ideogram 3.0", - "Slug": "post-edit-image-v3", - "Description": "Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Title": "Edit (legacy)", + "Slug": "post-edit-image", + "Description": "Edit a given image synchronously using the provided mask. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style type can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "http", - "Code": "### Edit with Ideogram 3.0\n# @name post_edit_image_v3\nPOST {{host}}/v1/ideogram-v3/edit\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Image edits generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt or Initial Image failed the safety checks.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Edit (legacy)\n# @name post_edit_image\nPOST {{host}}/edit\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Image edits generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt or Initial Image failed the safety checks.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", "Format": "http", - "OperationId": "post_edit_image_v3", + "OperationId": "post_edit_image", "Setup": null }, { @@ -105,57 +105,123 @@ "Slug": "post-generate-design-v3", "Description": "Generates a design synchronously from a text prompt using the Ideogram 3.0 model, then detects and corrects text layers within the generated image.\n\nThe response includes the generated image URL along with detected text layers (with font, size, color, position) and image asset layers.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "http", - "Code": "### Generate a design from a text prompt with text detection and correction\n# @name post_generate_design_v3\nPOST {{host}}/v1/ideogram-v3/generate-design\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A birthday card saying \\u0027Happy Birthday\\u0027\u0022,\n \u0022seed\u0022: 12345,\n \u0022resolution\u0022: \u00221280x800\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022color_palette\u0022: {\n \u0022name\u0022: \u0022PASTEL\u0022\n },\n \u0022style_codes\u0022: [\n \u0022AAFF5733\u0022,\n \u00220133FF57\u0022,\n \u0022DE3357FF\u0022\n ],\n \u0022style_type\u0022: \u0022GENERAL\u0022,\n \u0022style_preset\u0022: \u0022BRIGHT_ART\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022,\n \u0022font_file_h1\u0022: \u0022\u0022,\n \u0022font_name_h1\u0022: \u0022Ubuntu-Bold.ttf\u0022,\n \u0022font_file_h2\u0022: \u0022\u0022,\n \u0022font_name_h2\u0022: \u0022string\u0022,\n \u0022font_file_body\u0022: \u0022\u0022,\n \u0022font_name_body\u0022: \u0022string\u0022,\n \u0022font_file_small\u0022: \u0022\u0022,\n \u0022font_name_small\u0022: \u0022string\u0022,\n \u0022style_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022reference_asset_images\u0022: [\n \u0022\u0022\n ]\n}\n\n## Responses\n# 200\n# Description: Design(s) generated successfully with text correction.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Generate a design from a text prompt with text detection and correction\n# @name post_generate_design_v3\nPOST {{host}}/v1/ideogram-v3/generate-design\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A birthday card saying \\u0027Happy Birthday\\u0027\u0022,\n \u0022seed\u0022: 12345,\n \u0022resolution\u0022: \u00221280x800\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022color_palette\u0022: {\n \u0022name\u0022: \u0022PASTEL\u0022\n },\n \u0022style_codes\u0022: [\n \u0022AAFF5733\u0022,\n \u00220133FF57\u0022,\n \u0022DE3357FF\u0022\n ],\n \u0022style_type\u0022: \u0022GENERAL\u0022,\n \u0022style_preset\u0022: \u0022BRIGHT_ART\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022,\n \u0022font_file_h1\u0022: \u0022\u0022,\n \u0022font_name_h1\u0022: \u0022Ubuntu-Bold.ttf\u0022,\n \u0022font_file_h2\u0022: \u0022\u0022,\n \u0022font_name_h2\u0022: \u0022string\u0022,\n \u0022font_file_body\u0022: \u0022\u0022,\n \u0022font_name_body\u0022: \u0022string\u0022,\n \u0022font_file_small\u0022: \u0022\u0022,\n \u0022font_name_small\u0022: \u0022string\u0022,\n \u0022style_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022reference_asset_images\u0022: [\n \u0022\u0022\n ]\n}\n\n## Responses\n# 200\n# Description: Design(s) generated successfully with text correction.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", "Format": "http", "OperationId": "post_generate_design_v3", "Setup": null }, { "Order": 11, + "Title": "Generate an editable design with Ideogram 4.0 HTML", + "Slug": "post-generate-design-v4", + "Description": "Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.\n\nOptionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Language": "http", + "Code": "### Generate an editable design with Ideogram 4.0 HTML\n# @name post_generate_design_v4\nPOST {{host}}/v1/ideogram-v4/generate-design\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json, image/png, text/html\n\n{\n \u0022prompt\u0022: \u0022string\u0022,\n \u0022seed\u0022: 0,\n \u0022magic_prompt_option\u0022: \u0022ON\u0022,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022resolution\u0022: \u00221024x1024\u0022,\n \u0022rendering_speed\u0022: {},\n \u0022inspiration_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022inspiration_reference_model\u0022: \u0022claude-sonnet-4-6\u0022,\n \u0022artifact_generation_model\u0022: \u0022claude-sonnet-4-6\u0022,\n \u0022layout2image_variant\u0022: \u0022opus_4_7\u0022,\n \u0022response_type\u0022: \u0022layered\u0022\n}\n\n## Responses\n# 200\n# Description: Design(s) generated successfully.\n# Content-Type: application/json, image/png, text/html\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_design_v4", + "Setup": null + }, + { + "Order": 12, + "Title": "Generate an editable V4 HTML design asynchronously via webhook", + "Slug": "post-generate-design-v4-async", + "Description": "Accepts an Ideogram 4.0 HTML design request for asynchronous processing and\nreturns immediately with a request_id. The generated design is POSTed to the\nsupplied \u0060webhook_url\u0060 once ready.", + "Language": "http", + "Code": "### Generate an editable V4 HTML design asynchronously via webhook\n# @name post_generate_design_v4_async\nPOST {{host}}/v1/ideogram-v4/async/generate-design?webhook_url={{webhook_url}}\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022string\u0022,\n \u0022seed\u0022: 0,\n \u0022magic_prompt_option\u0022: \u0022ON\u0022,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022resolution\u0022: \u00221024x1024\u0022,\n \u0022rendering_speed\u0022: {},\n \u0022inspiration_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022inspiration_reference_model\u0022: \u0022claude-sonnet-4-6\u0022,\n \u0022artifact_generation_model\u0022: \u0022claude-sonnet-4-6\u0022,\n \u0022layout2image_variant\u0022: \u0022opus_4_7\u0022,\n \u0022response_type\u0022: \u0022layered\u0022\n}\n\n## Responses\n# 200\n# Description: Request accepted for asynchronous delivery.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_design_v4_async", + "Setup": null + }, + { + "Order": 13, "Title": "Generate (legacy)", "Slug": "post-generate-image", "Description": "Generates images synchronously based on a given prompt and optional parameters.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.GenerateImageRequest\u003E(\n @\u0022{\n \u0022\u0022image_request\u0022\u0022: {\n \u0022\u0022aspect_ratio\u0022\u0022: \u0022\u0022ASPECT_10_16\u0022\u0022,\n \u0022\u0022magic_prompt_option\u0022\u0022: \u0022\u0022AUTO\u0022\u0022,\n \u0022\u0022model\u0022\u0022: \u0022\u0022V_2\u0022\u0022,\n \u0022\u0022prompt\u0022\u0022: \u0022\u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022\u0022\n }\n}\u0022)!;\n\nvar response = await client.Generate.PostGenerateImageAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022data\u0022: [\n// {\n// \u0022style_type\u0022: \u0022REALISTIC\u0022,\n// \u0022seed\u0022: 12345,\n// \u0022upscaled_resolution\u0022: \u00224096x4096\u0022,\n// \u0022prompt\u0022: \u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022,\n// \u0022resolution\u0022: \u00221024x1024\u0022,\n// \u0022url\u0022: \u0022https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g\u0022,\n// \u0022is_image_safe\u0022: true\n// },\n// {\n// \u0022style_type\u0022: \u0022REALISTIC\u0022,\n// \u0022seed\u0022: 12345,\n// \u0022upscaled_resolution\u0022: \u00224096x4096\u0022,\n// \u0022prompt\u0022: \u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022,\n// \u0022resolution\u0022: \u00221024x1024\u0022,\n// \u0022url\u0022: \u0022https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g\u0022,\n// \u0022is_image_safe\u0022: true\n// }\n// ],\n// \u0022created\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022\n// }", + "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.GenerateImageRequest\u003E(\n @\u0022{\n \u0022\u0022image_request\u0022\u0022: {\n \u0022\u0022aspect_ratio\u0022\u0022: \u0022\u0022ASPECT_10_16\u0022\u0022,\n \u0022\u0022magic_prompt_option\u0022\u0022: \u0022\u0022AUTO\u0022\u0022,\n \u0022\u0022model\u0022\u0022: \u0022\u0022V_2\u0022\u0022,\n \u0022\u0022prompt\u0022\u0022: \u0022\u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022\u0022\n }\n}\u0022)!;\n\nvar response = await client.Generate.PostGenerateImageAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022data\u0022: [\n// {\n// \u0022style_type\u0022: \u0022REALISTIC\u0022,\n// \u0022seed\u0022: 12345,\n// \u0022upscaled_resolution\u0022: \u00224096x4096\u0022,\n// \u0022prompt\u0022: \u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022,\n// \u0022resolution\u0022: \u00221024x1024\u0022,\n// \u0022url\u0022: \u0022https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g\u0022,\n// \u0022is_image_safe\u0022: true\n// },\n// {\n// \u0022style_type\u0022: \u0022REALISTIC\u0022,\n// \u0022seed\u0022: 12345,\n// \u0022upscaled_resolution\u0022: \u00224096x4096\u0022,\n// \u0022prompt\u0022: \u0022A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there\\u0027s an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.\u0022,\n// \u0022resolution\u0022: \u00221024x1024\u0022,\n// \u0022url\u0022: \u0022https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g\u0022,\n// \u0022is_image_safe\u0022: true\n// }\n// ],\n// \u0022created\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022request_id\u0022: \u0022request_id\u0022\n// }", "Format": "sdk", "OperationId": "post_generate_image", "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 12, + "Order": 14, "Title": "Generate with Ideogram 3.0", "Slug": "post-generate-image-v3", "Description": "Generates images synchronously based on a given prompt and optional parameters using the Ideogram 3.0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "http", - "Code": "### Generate with Ideogram 3.0\n# @name post_generate_image_v3\nPOST {{host}}/v1/ideogram-v3/generate\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A photo of a cat\u0022,\n \u0022seed\u0022: 12345,\n \u0022resolution\u0022: \u00221280x800\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022color_palette\u0022: {\n \u0022name\u0022: \u0022PASTEL\u0022\n },\n \u0022style_codes\u0022: [\n \u0022AAFF5733\u0022,\n \u00220133FF57\u0022,\n \u0022DE3357FF\u0022\n ],\n \u0022style_type\u0022: \u0022GENERAL\u0022,\n \u0022style_preset\u0022: \u0022BRIGHT_ART\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022,\n \u0022style_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022character_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022character_reference_images_mask\u0022: [\n \u0022\u0022\n ]\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Generate with Ideogram 3.0\n# @name post_generate_image_v3\nPOST {{host}}/v1/ideogram-v3/generate\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A photo of a cat\u0022,\n \u0022seed\u0022: 12345,\n \u0022resolution\u0022: \u00221280x800\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022color_palette\u0022: {\n \u0022name\u0022: \u0022PASTEL\u0022\n },\n \u0022style_codes\u0022: [\n \u0022AAFF5733\u0022,\n \u00220133FF57\u0022,\n \u0022DE3357FF\u0022\n ],\n \u0022style_type\u0022: \u0022GENERAL\u0022,\n \u0022style_preset\u0022: \u0022BRIGHT_ART\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022,\n \u0022style_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022character_reference_images\u0022: [\n \u0022\u0022\n ],\n \u0022character_reference_images_mask\u0022: [\n \u0022\u0022\n ],\n \u0022enable_copyright_detection\u0022: true\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", "Format": "http", "OperationId": "post_generate_image_v3", "Setup": null }, { - "Order": 13, + "Order": 15, "Title": "Generate with Ideogram 3.0 (Transparent Background)", "Slug": "post-generate-image-v3-transparent", - "Description": "Generates images with transparent background synchronously based on a given prompt and optional parameters using\nthe Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio\nto allow best results with upscaler. The selected resolution is written to the response, not the upscaled final\nresolution.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Description": "Generates images with transparent background synchronously based on a given prompt and optional parameters using\nthe Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio\nto allow best results with upscaler. The selected resolution is written to the response, not the upscaled final\nresolution.\n\n\u0060rendering_speed=FLASH\u0060 is not supported for transparent-background generation; the request will return a 400.\nUse \u0060TURBO\u0060, \u0060DEFAULT\u0060, or \u0060QUALITY\u0060 instead.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "http", - "Code": "### Generate with Ideogram 3.0 (Transparent Background)\n# @name post_generate_image_v3_transparent\nPOST {{host}}/v1/ideogram-v3/generate-transparent\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A photo of a cat\u0022,\n \u0022seed\u0022: 12345,\n \u0022upscale_factor\u0022: \u0022X2\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Generate with Ideogram 3.0 (Transparent Background)\n# @name post_generate_image_v3_transparent\nPOST {{host}}/v1/ideogram-v3/generate-transparent\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022A photo of a cat\u0022,\n \u0022seed\u0022: 12345,\n \u0022upscale_factor\u0022: \u0022X2\u0022,\n \u0022aspect_ratio\u0022: \u00221x3\u0022,\n \u0022rendering_speed\u0022: \u0022DEFAULT\u0022,\n \u0022magic_prompt\u0022: \u0022ON\u0022,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022negative_prompt\u0022: \u0022brush strokes, painting\u0022,\n \u0022num_images\u0022: 1,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/1\u0022\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to generate an image.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", "Format": "http", "OperationId": "post_generate_image_v3_transparent", "Setup": null }, { - "Order": 14, + "Order": 16, "Title": "Generate with Ideogram 4.0", "Slug": "post-generate-image-v4", "Description": "Generates images synchronously using the Ideogram 4.0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "Language": "http", - "Code": "### Generate with Ideogram 4.0\n# @name post_generate_image_v4\nPOST {{host}}/v1/ideogram-v4/generate\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022prompt\u0022: \u0022string\u0022,\n \u0022seed\u0022: 0,\n \u0022magic_prompt_option\u0022: \u0022ON\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/0\u0022\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Code": "### Generate with Ideogram 4.0\n# @name post_generate_image_v4\nPOST {{host}}/v1/ideogram-v4/generate\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022text_prompt\u0022: \u0022string\u0022,\n \u0022json_prompt\u0022: {\n \u0022high_level_description\u0022: \u0022string\u0022,\n \u0022style_description\u0022: {\n \u0022photo\u0022: \u0022photo\u0022,\n \u0022art_style\u0022: \u0022art_style\u0022,\n \u0022medium\u0022: \u0022medium\u0022,\n \u0022aesthetics\u0022: \u0022aesthetics\u0022,\n \u0022lighting\u0022: \u0022lighting\u0022\n },\n \u0022compositional_deconstruction\u0022: {\n \u0022background\u0022: \u0022background\u0022,\n \u0022elements\u0022: [\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n },\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n }\n ]\n },\n \u0022tags\u0022: [\n \u0022string\u0022\n ]\n },\n \u0022seed\u0022: 0,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/0\u0022,\n \u0022resolution\u0022: \u00222048x2048\u0022,\n \u0022rendering_speed\u0022: {},\n \u0022enable_copyright_detection\u0022: true\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", "Format": "http", "OperationId": "post_generate_image_v4", "Setup": null }, { - "Order": 15, + "Order": 17, + "Title": "Generate with Ideogram 4.0 asynchronously via webhook", + "Slug": "post-generate-image-v4-async", + "Description": "Accepts an Ideogram 4.0 generation request for asynchronous processing and\nreturns immediately with a generation_id. The generated images are POSTed to\nthe supplied \u0060webhook_url\u0060 once ready, in a payload that mirrors the\nsynchronous response with an added generation_id for correlation.", + "Language": "http", + "Code": "### Generate with Ideogram 4.0 asynchronously via webhook\n# @name post_generate_image_v4_async\nPOST {{host}}/v1/ideogram-v4/async/generate?webhook_url={{webhook_url}}\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022text_prompt\u0022: \u0022string\u0022,\n \u0022json_prompt\u0022: {\n \u0022high_level_description\u0022: \u0022string\u0022,\n \u0022style_description\u0022: {\n \u0022photo\u0022: \u0022photo\u0022,\n \u0022art_style\u0022: \u0022art_style\u0022,\n \u0022medium\u0022: \u0022medium\u0022,\n \u0022aesthetics\u0022: \u0022aesthetics\u0022,\n \u0022lighting\u0022: \u0022lighting\u0022\n },\n \u0022compositional_deconstruction\u0022: {\n \u0022background\u0022: \u0022background\u0022,\n \u0022elements\u0022: [\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n },\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n }\n ]\n },\n \u0022tags\u0022: [\n \u0022string\u0022\n ]\n },\n \u0022seed\u0022: 0,\n \u0022magic_prompt_system_prompt_config_id\u0022: \u0022string\u0022,\n \u0022custom_model_uri\u0022: \u0022model/my-custom-model/version/0\u0022,\n \u0022resolution\u0022: \u00222048x2048\u0022,\n \u0022rendering_speed\u0022: {},\n \u0022enable_copyright_detection\u0022: true\n}\n\n## Responses\n# 200\n# Description: Request accepted for asynchronous delivery.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_image_v4_async", + "Setup": null + }, + { + "Order": 18, + "Title": "Image-to-image with Ideogram 4.0", + "Slug": "post-generate-image-v4-im2-im", + "Description": "Generates images synchronously using the Ideogram 4.0 model with an initial image as input.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Language": "http", + "Code": "### Image-to-image with Ideogram 4.0\n# @name post_generate_image_v4_im2_im\nPOST {{host}}/v1/ideogram-v4/image-to-image\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_image_v4_im2_im", + "Setup": null + }, + { + "Order": 19, + "Title": "Image-to-image with Ideogram 4.0 asynchronously via webhook", + "Slug": "post-generate-image-v4-im2-im-async", + "Description": "Accepts an Ideogram 4.0 image-to-image request for asynchronous processing\nand returns immediately with a request_id. The generated images are POSTed\nto the supplied \u0060webhook_url\u0060 once ready.", + "Language": "http", + "Code": "### Image-to-image with Ideogram 4.0 asynchronously via webhook\n# @name post_generate_image_v4_im2_im_async\nPOST {{host}}/v1/ideogram-v4/async/image-to-image?webhook_url={{webhook_url}}\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Request accepted for asynchronous delivery.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_image_v4_im2_im_async", + "Setup": null + }, + { + "Order": 20, + "Title": "Generate with Ideogram 4.0 (stable model)", + "Slug": "post-generate-image-v4-stable", + "Description": "Generates images synchronously using a pinned stable build of the\nIdeogram 4.0 model. This endpoint is intentionally minimal: it accepts\nonly a prompt (and optional seed), pins the underlying model URI, and\nlets the server pick the output resolution automatically.\n\nImages links are available for a limited period of time; if you would\nlike to keep the image, you must download it.", + "Language": "http", + "Code": "### Generate with Ideogram 4.0 (stable model)\n# @name post_generate_image_v4_stable\nPOST {{host}}/v1/ideogram-v4/generate/stable\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022text_prompt\u0022: \u0022string\u0022,\n \u0022json_prompt\u0022: {\n \u0022high_level_description\u0022: \u0022string\u0022,\n \u0022style_description\u0022: {\n \u0022photo\u0022: \u0022photo\u0022,\n \u0022art_style\u0022: \u0022art_style\u0022,\n \u0022medium\u0022: \u0022medium\u0022,\n \u0022aesthetics\u0022: \u0022aesthetics\u0022,\n \u0022lighting\u0022: \u0022lighting\u0022\n },\n \u0022compositional_deconstruction\u0022: {\n \u0022background\u0022: \u0022background\u0022,\n \u0022elements\u0022: [\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n },\n {\n \u0022bbox\u0022: [\n 0,\n 0,\n 1000,\n 1000\n ],\n \u0022type\u0022: \u0022obj\u0022,\n \u0022desc\u0022: \u0022desc\u0022\n }\n ]\n },\n \u0022tags\u0022: [\n \u0022string\u0022\n ]\n },\n \u0022seed\u0022: 0,\n \u0022resolution\u0022: {},\n \u0022version\u0022: \u0022stable_may29\u0022\n}\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_generate_image_v4_stable", + "Setup": null + }, + { + "Order": 21, "Title": "Inpaint with Ideogram 3.0", "Slug": "post-inpaint-image-v3", "Description": "Inpaint a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -166,7 +232,7 @@ "Setup": null }, { - "Order": 16, + "Order": 22, "Title": "Layerize an existing flat graphic image with text detection and correction", "Slug": "post-layerize-design-v3", "Description": "Processes an existing flat graphic image to detect and correct text layers without generating a new image from scratch.\n\nThe uploaded image is analyzed for text content, which is then removed and returned as structured text layers with font matching, sizing, and color information.\n\nSupported image formats include JPEG, PNG, and WebP (max size 10MB).\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -177,7 +243,7 @@ "Setup": null }, { - "Order": 17, + "Order": 23, "Title": "Layerize Text", "Slug": "post-layerize-text-v3", "Description": "Analyzes an image to detect text regions, then returns each detected text block with its position, content, font information, and styling.\n\nThe response includes a text-erased base image (background with all text removed) and a flat list of detected text blocks.\n\nSupported image formats include JPEG, PNG, and WebP (max size 10MB).\n\nImage links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -188,7 +254,7 @@ "Setup": null }, { - "Order": 18, + "Order": 24, "Title": "Reframe (legacy)", "Slug": "post-reframe-image", "Description": "Reframe a square image to a chosen resolution. The supported image formats include JPEG, PNG, and WebP.\n\nImage links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -199,7 +265,7 @@ "Setup": null }, { - "Order": 19, + "Order": 25, "Title": "Reframe with Ideogram 3.0", "Slug": "post-reframe-image-v3", "Description": "Reframe a square image to a chosen resolution with Ideogram 3.0. The supported image formats include JPEG, PNG, and WebP.\n\nImage links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -210,7 +276,7 @@ "Setup": null }, { - "Order": 20, + "Order": 26, "Title": "Remix (legacy)", "Slug": "post-remix-image", "Description": "Remix provided images synchronously based on a given prompt and optional parameters.\n\nInput images are cropped to the chosen aspect ratio before being remixed.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -221,7 +287,7 @@ "Setup": null }, { - "Order": 21, + "Order": 27, "Title": "Remix with Ideogram 3.0", "Slug": "post-remix-image-v3", "Description": "Remix provided images synchronously based on a given prompt and optional parameters with the Ideogram 3.0 model.\n\nInput images are cropped to the chosen aspect ratio before being remixed.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -232,7 +298,29 @@ "Setup": null }, { - "Order": 22, + "Order": 28, + "Title": "Remix with Ideogram 4.0", + "Slug": "post-remix-image-v4", + "Description": "Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.\n\nMirrors \u0060/v1/ideogram-v3/remix\u0060 semantics (including \u0060image_weight\u0060 for how strongly the\noutput should resemble the input image) but routes the request through the V_4_0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "Language": "http", + "Code": "### Remix with Ideogram 4.0\n# @name post_remix_image_v4\nPOST {{host}}/v1/ideogram-v4/remix\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Image(s) generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized.\n# 422\n# Description: Prompt failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_remix_image_v4", + "Setup": null + }, + { + "Order": 29, + "Title": "Remove Background", + "Slug": "post-remove-background", + "Description": "Remove the background of a given image synchronously. The foreground subject\nis identified and returned on a transparent background. Supported image formats include JPEG,\nPNG, and WebP.\nImage links are available for a limited period of time; if you would like to keep the image,\nyou must download it.", + "Language": "http", + "Code": "### Remove Background\n# @name post_remove_background\nPOST {{host}}/v1/remove-background\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Background removed successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 401\n# Description: Not authorized to remove background.\n# 422\n# Description: Initial image failed the safety checks.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.", + "Format": "http", + "OperationId": "post_remove_background", + "Setup": null + }, + { + "Order": 30, "Title": "Replace Background with Ideogram 3.0", "Slug": "post-replace-background-v3", "Description": "Replace the background of a given image synchronously using a prompt with Ideogram 3.0. The foreground subject\nwill be identified and kept, while the background is replaced based on the prompt and chosen style.\nSupported image formats include JPEG, PNG, and WebP.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -243,7 +331,7 @@ "Setup": null }, { - "Order": 23, + "Order": 31, "Title": "Virtual Try-On with Ideogram 3.0", "Slug": "post-try-on-v3", "Description": "Performs virtual clothing try-on by automatically segmenting the clothing in the provided image\nand replacing it based on the prompt. The user provides an image and an optional prompt describing\nthe desired clothing change (e.g., \u0022change his shirt to a pink shirt\u0022).\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -254,7 +342,7 @@ "Setup": null }, { - "Order": 24, + "Order": 32, "Title": "Upscale", "Slug": "post-upscale-image", "Description": "Upscale provided images synchronously with an optional prompt.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -265,7 +353,7 @@ "Setup": null }, { - "Order": 25, + "Order": 33, "Title": "Edit images with a prompt", "Slug": "post-v1-edit-image", "Description": "Edit one or more images using a text prompt. Provide images via file upload\nor Ideogram image URLs, and describe the desired edit in your prompt.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", @@ -276,7 +364,7 @@ "Setup": null }, { - "Order": 26, + "Order": 34, "Title": "Testing", "Slug": "post-internal-testing", "Description": "Just a testing endpoint", @@ -287,7 +375,7 @@ "Setup": null }, { - "Order": 27, + "Order": 35, "Title": "Add members to a specific organization", "Slug": "add-organization-members", "Description": "Generated from OpenAPI examples.", @@ -298,29 +386,40 @@ "Setup": null }, { - "Order": 28, + "Order": 36, "Title": "Creates an API key.", "Slug": "create-api-key", "Description": "Generated from OpenAPI examples.", "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Manage.CreateApiKeyAsync();\n\n// Example response:\n// {\n// \u0022api_key\u0022: \u0022example_api_key_replace_with_your_actual_key\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg==\u0022\n// }", + "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.CreateApiKeyRequest\u003E(\n @\u0022{\n \u0022\u0022label\u0022\u0022: \u0022\u0022label\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Manage.CreateApiKeyAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022api_key\u0022: \u0022example_api_key_replace_with_your_actual_key\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg==\u0022\n// }", "Format": "sdk", "OperationId": "create_api_key", "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 29, + "Order": 37, "Title": "Create an API key for a specific organization", "Slug": "create-api-key-v2", "Description": "Generated from OpenAPI examples.", "Language": "http", - "Code": "### Create an API key for a specific organization\n# @name create_api_key_v2\nPOST {{host}}/manage/api/api_keys_v2?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: API key created successfully\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 402\n# Description: Payment is required before creating an API key.\n# 403\n# Description: Not authorized", + "Code": "### Create an API key for a specific organization\n# @name create_api_key_v2\nPOST {{host}}/manage/api/api_keys_v2?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022label\u0022: \u0022label\u0022\n}\n\n## Responses\n# 200\n# Description: API key created successfully\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 402\n# Description: Payment is required before creating an API key.\n# 403\n# Description: Not authorized", "Format": "http", "OperationId": "create_api_key_v2", "Setup": null }, { - "Order": 30, + "Order": 38, + "Title": "Create a payment setup session for inline card collection.", + "Slug": "create-api-payment", + "Description": "Returns a client_secret for the org\u0027s payment customer so the inline payment\nmodal can save a card without leaving the app.\n\nSoft-deprecated: the inline Elements flow was removed in the Stripe.js\neager-bundle incident (2026-05-20). New clients should use the\nstripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which\nreturns a hosted Stripe Checkout URL instead. This endpoint will be formally\ndeprecated and then removed once no callers reference it.", + "Language": "http", + "Code": "### Create a payment setup session for inline card collection.\n# @name create_api_payment\nPOST {{host}}/manage/api/payment?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: client_secret for inline card collection.\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", + "OperationId": "create_api_payment", + "Setup": null + }, + { + "Order": 39, "Title": "Delete an API key.", "Slug": "delete-single-api-key", "Description": "Generated from OpenAPI examples.", @@ -331,7 +430,18 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 31, + "Order": 40, + "Title": "Lifetime credit totals for the API user\u0027s account.", + "Slug": "get-api-credit-summary", + "Description": "Returns the lifetime credit KPIs (consumed, expired, issued) used to\nrender the API credit dashboard strip. All values default to $0 when\nMetronome is unavailable so the FE can always render.", + "Language": "http", + "Code": "### Lifetime credit totals for the API user\u0027s account.\n# @name get_api_credit_summary\nGET {{host}}/manage/api/credit_summary?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: API credit summary content\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", + "OperationId": "get_api_credit_summary", + "Setup": null + }, + { + "Order": 41, "Title": "Retrieve current API keys and their respective data.", "Slug": "get-api-keys", "Description": "Generated from OpenAPI examples.", @@ -342,7 +452,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 32, + "Order": 42, "Title": "Retrieve API keys for a specific organization", "Slug": "get-api-keys-v2", "Description": "Generated from OpenAPI examples.", @@ -353,7 +463,7 @@ "Setup": null }, { - "Order": 33, + "Order": 43, "Title": "Get search results for user handles with suggestions for a particular organization.", "Slug": "get-api-organization-user-suggestions", "Description": "Generated from OpenAPI examples.", @@ -364,40 +474,40 @@ "Setup": null }, { - "Order": 34, + "Order": 44, "Title": "Retrieve the user\u0027s current API profiles", "Slug": "get-api-profiles", "Description": "Generated from OpenAPI examples.", "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Manage.GetApiProfilesAsync();\n\n// Example response:\n// {\n// \u0022profiles\u0022: [\n// {\n// \u0022is_metronome_2_user\u0022: true,\n// \u0022role\u0022: \u0022OWNER\u0022,\n// \u0022avatar_url\u0022: \u0022https://example.com/avatar.jpg\u0022,\n// \u0022organization_id\u0022: \u0022b3JnYW5pemF0aW9uXzEyMw\u0022,\n// \u0022name\u0022: \u0022Gamma\u0022,\n// \u0022type\u0022: \u0022INDIVIDUAL\u0022,\n// \u0022api_keys\u0022: [\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// },\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// }\n// ],\n// \u0022max_num_inflight_requests_permitted\u0022: 10\n// },\n// {\n// \u0022is_metronome_2_user\u0022: true,\n// \u0022role\u0022: \u0022OWNER\u0022,\n// \u0022avatar_url\u0022: \u0022https://example.com/avatar.jpg\u0022,\n// \u0022organization_id\u0022: \u0022b3JnYW5pemF0aW9uXzEyMw\u0022,\n// \u0022name\u0022: \u0022Gamma\u0022,\n// \u0022type\u0022: \u0022INDIVIDUAL\u0022,\n// \u0022api_keys\u0022: [\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// },\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// }\n// ],\n// \u0022max_num_inflight_requests_permitted\u0022: 10\n// }\n// ]\n// }", + "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Manage.GetApiProfilesAsync();\n\n// Example response:\n// {\n// \u0022profiles\u0022: [\n// {\n// \u0022is_metronome_2_user\u0022: true,\n// \u0022copyright_detection_enabled\u0022: true,\n// \u0022role\u0022: \u0022OWNER\u0022,\n// \u0022avatar_url\u0022: \u0022https://example.com/avatar.jpg\u0022,\n// \u0022organization_id\u0022: \u0022b3JnYW5pemF0aW9uXzEyMw\u0022,\n// \u0022name\u0022: \u0022Gamma\u0022,\n// \u0022type\u0022: \u0022INDIVIDUAL\u0022,\n// \u0022api_keys\u0022: [\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022label\u0022: \u0022Live production environment\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// },\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022label\u0022: \u0022Live production environment\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// }\n// ],\n// \u0022max_num_inflight_requests_permitted\u0022: 10\n// },\n// {\n// \u0022is_metronome_2_user\u0022: true,\n// \u0022copyright_detection_enabled\u0022: true,\n// \u0022role\u0022: \u0022OWNER\u0022,\n// \u0022avatar_url\u0022: \u0022https://example.com/avatar.jpg\u0022,\n// \u0022organization_id\u0022: \u0022b3JnYW5pemF0aW9uXzEyMw\u0022,\n// \u0022name\u0022: \u0022Gamma\u0022,\n// \u0022type\u0022: \u0022INDIVIDUAL\u0022,\n// \u0022api_keys\u0022: [\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022label\u0022: \u0022Live production environment\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// },\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022label\u0022: \u0022Live production environment\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// }\n// ],\n// \u0022max_num_inflight_requests_permitted\u0022: 10\n// }\n// ]\n// }", "Format": "sdk", "OperationId": "get_api_profiles", "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 35, + "Order": 45, "Title": "Retrieve data relevant to connecting to Stripe.", "Slug": "get-api-stripe-subscription", "Description": "Generated from OpenAPI examples.", - "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Manage.GetApiStripeSubscriptionAsync();\n\n// Example response:\n// {\n// \u0022stripe_subscription_url\u0022: \u0022stripe_subscription_url\u0022,\n// \u0022stripe_billing_url\u0022: \u0022stripe_billing_url\u0022\n// }", - "Format": "sdk", + "Language": "http", + "Code": "### Retrieve data relevant to connecting to Stripe.\n# @name get_api_stripe_subscription\nGET {{host}}/manage/api/stripe_subscription?organization_id={{organization_id}}\u0026isBusiness={{isBusiness}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: API subscription content related to connecting to Stripe\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", "OperationId": "get_api_stripe_subscription", - "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + "Setup": null }, { - "Order": 36, + "Order": 46, "Title": "Retrieve data relevant to creating an API subscription.", "Slug": "get-api-subscription", "Description": "Generated from OpenAPI examples.", - "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Manage.GetApiSubscriptionAsync();\n\n// Example response:\n// {\n// \u0022recharge_settings\u0022: {\n// \u0022is_active\u0022: true\n// },\n// \u0022has_stripe_setup\u0022: true,\n// \u0022metronome_dashboard_dark_mode_url\u0022: \u0022metronome_dashboard_dark_mode_url\u0022,\n// \u0022stripe_billing_url\u0022: \u0022stripe_billing_url\u0022,\n// \u0022current_balance\u0022: {\n// \u0022amount\u0022: 1050,\n// \u0022currency_code\u0022: \u0022USD\u0022\n// },\n// \u0022has_accepted_terms\u0022: true,\n// \u0022metronome_dashboard_url\u0022: \u0022metronome_dashboard_url\u0022,\n// \u0022metronome_links\u0022: {\n// \u0022usage_iframe_url\u0022: \u0022usage_iframe_url\u0022,\n// \u0022usage_iframe_dark_mode_url\u0022: \u0022usage_iframe_dark_mode_url\u0022,\n// \u0022credits_iframe_dark_mode_url\u0022: \u0022credits_iframe_dark_mode_url\u0022,\n// \u0022invoices_iframe_dark_mode_url\u0022: \u0022invoices_iframe_dark_mode_url\u0022,\n// \u0022invoices_iframe_url\u0022: \u0022invoices_iframe_url\u0022,\n// \u0022credits_iframe_url\u0022: \u0022credits_iframe_url\u0022\n// }\n// }", - "Format": "sdk", + "Language": "http", + "Code": "### Retrieve data relevant to creating an API subscription.\n# @name get_api_subscription\nGET {{host}}/manage/api/subscription?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: API subscription content\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", "OperationId": "get_api_subscription", - "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + "Setup": null }, { - "Order": 37, + "Order": 47, "Title": "Retrieve the latest terms of service for API usage.", "Slug": "get-api-terms", "Description": "Generated from OpenAPI examples.", @@ -408,7 +518,18 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 38, + "Order": 48, + "Title": "Retrieve the Stripe billing portal URL for a specific organization", + "Slug": "get-organization-billing-portal", + "Description": "Generated from OpenAPI examples.", + "Language": "http", + "Code": "### Retrieve the Stripe billing portal URL for a specific organization\n# @name get_organization_billing_portal\nGET {{host}}/manage/api/organization/billing_portal?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Billing portal URL retrieved successfully\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized\n# 404\n# Description: Organization not found", + "Format": "http", + "OperationId": "get_organization_billing_portal", + "Setup": null + }, + { + "Order": 49, "Title": "Retrieve members of a specific organization", "Slug": "get-organization-members", "Description": "Generated from OpenAPI examples.", @@ -419,7 +540,7 @@ "Setup": null }, { - "Order": 39, + "Order": 50, "Title": "Retrieve usage information segmented by time period with tool-specific breakdowns", "Slug": "get-usage-info", "Description": "Generated from OpenAPI examples.", @@ -430,7 +551,7 @@ "Setup": null }, { - "Order": 40, + "Order": 51, "Title": "Retrieve user credit information and spending metrics", "Slug": "get-user-credits", "Description": "Generated from OpenAPI examples.", @@ -441,7 +562,7 @@ "Setup": null }, { - "Order": 41, + "Order": 52, "Title": "Retrieve user spend commit information", "Slug": "get-user-spend-commit-info", "Description": "Generated from OpenAPI examples.", @@ -452,7 +573,7 @@ "Setup": null }, { - "Order": 42, + "Order": 53, "Title": "Retrieve invoices for a specific organization", "Slug": "list-organization-invoices", "Description": "Generated from OpenAPI examples.", @@ -463,29 +584,29 @@ "Setup": null }, { - "Order": 43, + "Order": 54, "Title": "Add credits to an API user\u0027s account.", "Slug": "post-add-credits-for-api", "Description": "Generated from OpenAPI examples.", - "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.PostAddCreditsRequest\u003E(\n @\u0022{\n \u0022\u0022amount\u0022\u0022: {\n \u0022\u0022amount\u0022\u0022: 1050,\n \u0022\u0022currency_code\u0022\u0022: \u0022\u0022USD\u0022\u0022\n }\n}\u0022)!;\n\nvar response = await client.Manage.PostAddCreditsForApiAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022amount\u0022: {\n// \u0022amount\u0022: 1050,\n// \u0022currency_code\u0022: \u0022USD\u0022\n// }\n// }", - "Format": "sdk", + "Language": "http", + "Code": "### Add credits to an API user\u0027s account.\n# @name post_add_credits_for_api\nPOST {{host}}/manage/api/add_credits?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022amount\u0022: {\n \u0022amount\u0022: 1050,\n \u0022currency_code\u0022: \u0022USD\u0022\n }\n}\n\n## Responses\n# 200\n# Description: API subscription content\n# Content-Type: application/json\n# 400\n# Description: Bad request\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", "OperationId": "post_add_credits_for_api", - "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + "Setup": null }, { - "Order": 44, + "Order": 55, "Title": "Update API subscription settings", "Slug": "post-api-subscription", "Description": "Generated from OpenAPI examples.", - "Language": "csharp", - "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.PostApiSubscriptionRequest\u003E(\n @\u0022{\n \u0022\u0022recharge_settings\u0022\u0022: {\n \u0022\u0022minimum_balance_threshold\u0022\u0022: {\n \u0022\u0022amount\u0022\u0022: 1050,\n \u0022\u0022currency_code\u0022\u0022: \u0022\u0022USD\u0022\u0022\n },\n \u0022\u0022top_up_balance\u0022\u0022: {\n \u0022\u0022amount\u0022\u0022: 1050,\n \u0022\u0022currency_code\u0022\u0022: \u0022\u0022USD\u0022\u0022\n }\n },\n \u0022\u0022is_active\u0022\u0022: true\n}\u0022)!;\n\nvar response = await client.Manage.PostApiSubscriptionAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022recharge_settings\u0022: {\n// \u0022is_active\u0022: true\n// }\n// }", - "Format": "sdk", + "Language": "http", + "Code": "### Update API subscription settings\n# @name post_api_subscription\nPOST {{host}}/manage/api/subscription?organization_id={{organization_id}}\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022recharge_settings\u0022: {\n \u0022minimum_balance_threshold\u0022: {\n \u0022amount\u0022: 1050,\n \u0022currency_code\u0022: \u0022USD\u0022\n },\n \u0022top_up_balance\u0022: {\n \u0022amount\u0022: 1050,\n \u0022currency_code\u0022: \u0022USD\u0022\n }\n },\n \u0022is_active\u0022: true\n}\n\n## Responses\n# 200\n# Description: API subscription content\n# Content-Type: application/json\n# 400\n# Description: Bad request\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized", + "Format": "http", "OperationId": "post_api_subscription", - "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + "Setup": null }, { - "Order": 45, + "Order": 56, "Title": "Accept terms", "Slug": "post-api-terms", "Description": "Generated from OpenAPI examples.", @@ -496,7 +617,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 46, + "Order": 57, "Title": "Promote members to OWNER role in a specific organization", "Slug": "promote-organization-members", "Description": "Generated from OpenAPI examples.", @@ -507,7 +628,7 @@ "Setup": null }, { - "Order": 47, + "Order": 58, "Title": "Reactivates a subscription by attempting to re-enable Metronome billing.", "Slug": "reactivate-subscription", "Description": "Generated from OpenAPI examples.", @@ -518,7 +639,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 48, + "Order": 59, "Title": "Remove members from a specific organization", "Slug": "remove-organization-members", "Description": "Generated from OpenAPI examples.", @@ -529,7 +650,29 @@ "Setup": null }, { - "Order": 49, + "Order": 60, + "Title": "Update a single field on an organization\u0027s API properties.", + "Slug": "update-organization-api-properties", + "Description": "Lets an organization owner toggle API-only settings such as\ncopyright_detection_enabled. Updates only the fields explicitly present\nin the request body; absent fields are left unchanged.", + "Language": "http", + "Code": "### Update a single field on an organization\u0027s API properties.\n# @name update_organization_api_properties\nPATCH {{host}}/manage/api/organization/{{organization_id}}/api_properties\nAuthorization: Bearer {{token}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022copyright_detection_enabled\u0022: true\n}\n\n## Responses\n# 200\n# Description: Updated API properties.\n# Content-Type: application/json\n# 401\n# Description: Not authorized\n# 403\n# Description: Not authorized \u2014 must be an organization owner\n# 404\n# Description: Organization not found", + "Format": "http", + "OperationId": "update_organization_api_properties", + "Setup": null + }, + { + "Order": 61, + "Title": "Update an API key\u0027s user-supplied label.", + "Slug": "update-single-api-key", + "Description": "Generated from OpenAPI examples.", + "Language": "csharp", + "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.PatchApiKeyRequest\u003E(\n @\u0022{\n \u0022\u0022label\u0022\u0022: \u0022\u0022Live production environment\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Manage.UpdateSingleApiKeyAsync(\n apiKeyId: \u0022d7abd0cd4ae94db78676e986a4ebd8dc\u0022,\n request: request\n);\n\n// Example response:\n// {\n// \u0022creation_time\u0022: \u00222000-01-23T04:56:07\\u002B00:00\u0022,\n// \u0022label\u0022: \u0022Live production environment\u0022,\n// \u0022redacted_api_key\u0022: \u0022ATG56\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\\u2022\u0022,\n// \u0022api_key_id\u0022: \u0022JRPVD7jWR1aTBYiJ0UFVOg\u0022,\n// \u0022status\u0022: null\n// }", + "Format": "sdk", + "OperationId": "update_single_api_key", + "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 62, "Title": "Get model details", "Slug": "get-custom-model", "Description": "Get detailed information about a specific custom model. The user must either own the model or the model must be shared with the user\u0027s organization via the model registry. Returns 404 if the model is not found or not accessible.", @@ -540,7 +683,7 @@ "Setup": null }, { - "Order": 50, + "Order": 63, "Title": "List models", "Slug": "list-custom-models", "Description": "Lists custom models for the authenticated user. Use the \u0060scope\u0060 parameter to control which models are returned. If omitted, returns both owned models and models shared with the user\u0027s organization via the model registry. \u0060owned\u0060 returns only models created by the user. \u0060shared\u0060 returns only models shared via the model registry, excluding the user\u0027s own models.", @@ -551,7 +694,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 51, + "Order": 64, "Title": "Train a custom Ideogram v3 model", "Slug": "train-model-v3", "Description": "Start training a custom Ideogram v3 model from a dataset using default hyperparameters. The dataset must contain at least 15 images and a maximum of 100 images.", @@ -562,7 +705,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 52, + "Order": 65, "Title": "Train a custom Ideogram v3 model with advanced hyperparameters", "Slug": "train-model-v3-advanced", "Description": "Start training a custom Ideogram v3 model from a dataset with caller-supplied hyperparameters (training steps, LoRA rank, EMA decay, learning rate). All hyperparameters are optional and fall back to defaults when omitted. The dataset must contain at least 15 images and a maximum of 100 images. Returns the model ID and training status.", @@ -573,7 +716,7 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 53, + "Order": 66, "Title": "Generate Magic Prompt", "Slug": "post-magic-prompt", "Description": "Transforms basic prompts into a magic prompt. Internal use only (feature flagged). TODO: update description if enabled externally.", @@ -584,7 +727,18 @@ "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." }, { - "Order": 54, + "Order": 67, + "Title": "Generate a Magic Prompt with Ideogram 4.0", + "Slug": "post-magic-prompt-v4", + "Description": "Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.\nThe magic prompt model version is fixed; callers cannot select it.\nWhen \u0060aspect_ratio\u0060 is \u0060AUTO\u0060 (the default), the model selects the most\nsuitable aspect ratio for the prompt and returns it in the response.", + "Language": "csharp", + "Code": "using var client = new IdeogramClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Ideogram.MagicPromptV4Request\u003E(\n @\u0022{\n \u0022\u0022text_prompt\u0022\u0022: \u0022\u0022a cat\u0022\u0022,\n \u0022\u0022aspect_ratio\u0022\u0022: \u0022\u0022AUTO\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Prompt.PostMagicPromptV4Async(\n request: request\n);\n\n// Example response:\n// {\n// \u0022json_prompt\u0022: {\n// \u0022high_level_description\u0022: \u0022A photorealistic ginger cat perched on a vintage wooden chair by a sunlit window.\u0022,\n// \u0022style_description\u0022: {\n// \u0022aesthetics\u0022: \u0022warm, cozy, nostalgic\u0022,\n// \u0022lighting\u0022: \u0022soft natural window light\u0022,\n// \u0022medium\u0022: \u0022photograph\u0022\n// },\n// \u0022compositional_deconstruction\u0022: {\n// \u0022background\u0022: \u0022A dim room with a bright window casting warm light.\u0022,\n// \u0022elements\u0022: [\n// {\n// \u0022type\u0022: \u0022obj\u0022,\n// \u0022desc\u0022: \u0022ginger cat with green eyes sitting upright on a vintage wooden chair\u0022\n// }\n// ]\n// }\n// },\n// \u0022aspect_ratio\u0022: \u00221x1\u0022\n// }", + "Format": "sdk", + "OperationId": "post_magic_prompt_v4", + "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 68, "Title": "Describe", "Slug": "post-describe", "Description": "Describe an image.\n\nSupported image formats include JPEG, PNG, and WebP.", @@ -593,6 +747,28 @@ "Format": "http", "OperationId": "post_describe", "Setup": null + }, + { + "Order": 69, + "Title": "Describe with Ideogram 4.0", + "Slug": "post-describe-v4", + "Description": "Describe an image with Ideogram 4.0 and return a structured\n\u0060V4JsonPrompt\u0060. The returned \u0060json_prompt\u0060 is a working JSON prompt\nthat can be passed directly as \u0060json_prompt\u0060 to the\n\u0060/v1/ideogram-v4/generate\u0060 family of endpoints.\n\nSupported image formats include JPEG, PNG, and WebP.", + "Language": "http", + "Code": "### Describe with Ideogram 4.0\n# @name post_describe_v4\nPOST {{host}}/v1/ideogram-v4/describe\nAuthorization: Bearer {{token}}\nContent-Type: multipart/form-data\nAccept: application/json\n\n## Responses\n# 200\n# Description: Structured V4 prompt generated successfully.\n# Content-Type: application/json\n# 400\n# Description: Invalid input provided.\n# 422\n# Description: Image failed the safety check.\n# Content-Type: application/json\n# 429\n# Description: Too many requests.\n# 503\n# Description: Took too long to finish.", + "Format": "http", + "OperationId": "post_describe_v4", + "Setup": null + }, + { + "Order": 70, + "Title": "Get the public keys used to verify webhook signatures", + "Slug": "get-webhook-signing-jwks", + "Description": "Returns the set of Ed25519 public keys Ideogram uses to sign outbound\nwebhook payloads. Customers verify incoming webhooks by recomputing the\ncanonical signed message (\u0060request_id\\nuser_id\\ntimestamp\\nsha256_hex(body)\u0060)\nand checking the \u0060X-Ideogram-Webhook-Signature\u0060 header against any key\nin this document.\n\nThe document includes the current signing key plus any keys recently\nrotated out, so signatures already in flight remain verifiable across\nrotations. Cache for up to 24 hours; refresh sooner if a signature\nfails to verify against the cached set.\n\nThis endpoint is public and unauthenticated \u2014 no API key is required.", + "Language": "csharp", + "Code": "using var client = new IdeogramClient(apiKey);\nvar response = await client.Webhooks.GetWebhookSigningJwksAsync();\n\n// Example response:\n// {\n// \u0022keys\u0022: [\n// {\n// \u0022kty\u0022: \u0022OKP\u0022,\n// \u0022crv\u0022: \u0022Ed25519\u0022,\n// \u0022use\u0022: \u0022sig\u0022,\n// \u0022kid\u0022: \u0022v1\u0022,\n// \u0022x\u0022: \u002211qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo\u0022,\n// \u0022alg\u0022: \u0022EdDSA\u0022\n// },\n// {\n// \u0022kty\u0022: \u0022OKP\u0022,\n// \u0022crv\u0022: \u0022Ed25519\u0022,\n// \u0022use\u0022: \u0022sig\u0022,\n// \u0022kid\u0022: \u0022v1\u0022,\n// \u0022x\u0022: \u002211qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo\u0022,\n// \u0022alg\u0022: \u0022EdDSA\u0022\n// }\n// ]\n// }", + "Format": "sdk", + "OperationId": "get_webhook_signing_jwks", + "Setup": "This example assumes \u0060using Ideogram;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." } ] } \ No newline at end of file diff --git a/src/libs/Ideogram/openapi.json b/src/libs/Ideogram/openapi.json index 788fd60..c16c859 100644 --- a/src/libs/Ideogram/openapi.json +++ b/src/libs/Ideogram/openapi.json @@ -74,6 +74,14 @@ "url": "https://docs.ideogram.ai" }, "name": "v4-generation" + }, + { + "description": "Endpoints related to webhook delivery and verification. The JWKS\nendpoint publishes the Ed25519 public keys customers use to verify\nthat an inbound webhook genuinely originated from Ideogram.\n", + "externalDocs": { + "description": "Find out more", + "url": "https://docs.ideogram.ai" + }, + "name": "webhooks" } ], "paths": { @@ -704,6 +712,17 @@ "/manage/api/add_credits": { "post": { "operationId": "post_add_credits_for_api", + "parameters": [ + { + "description": "Workspace to add credits to. The charge goes against the org's Stripe customer + Metronome customer.", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], "requestBody": { "content": { "application/json": { @@ -790,6 +809,18 @@ }, "post": { "operationId": "create_api_key", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateApiKeyRequest" + } + } + }, + "description": "Optional fields supplied when creating an API key.", + "required": false, + "x-body-name": "create_api_key_request" + }, "responses": { "200": { "content": { @@ -856,6 +887,64 @@ "manage" ], "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" + }, + "patch": { + "operationId": "update_single_api_key", + "parameters": [ + { + "description": "The ID of API key to operate on. Expected to be a URL safe Base64 encoded UUID.", + "example": "d7abd0cd4ae94db78676e986a4ebd8dc", + "in": "path", + "name": "api_key_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PatchApiKeyRequest" + } + } + }, + "description": "New label value for the API key.", + "required": true, + "x-body-name": "patch_api_key_request" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApiProfileApiKey" + } + } + }, + "description": "The updated API key." + }, + "400": { + "description": "Invalid request." + }, + "401": { + "description": "Not authorized." + }, + "404": { + "description": "API key not found." + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "summary": "Update an API key's user-supplied label.", + "tags": [ + "manage" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" } }, "/manage/api/api_keys_v2": { @@ -872,6 +961,18 @@ } } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateApiKeyRequest" + } + } + }, + "description": "Optional fields supplied when creating an API key.", + "required": false, + "x-body-name": "create_api_key_request" + }, "responses": { "200": { "content": { @@ -905,6 +1006,51 @@ "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" } }, + "/manage/api/credit_summary": { + "get": { + "description": "Returns the lifetime credit KPIs (consumed, expired, issued) used to\nrender the API credit dashboard strip. All values default to $0 when\nMetronome is unavailable so the FE can always render.\n", + "operationId": "get_api_credit_summary", + "parameters": [ + { + "description": "Workspace to summarize credits for. The caller must be OWNER or WRITER of the org.", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManageApiCreditSummaryResponse" + } + } + }, + "description": "API credit summary content" + }, + "401": { + "description": "Not authorized" + }, + "403": { + "description": "Not authorized" + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "summary": "Lifetime credit totals for the API user's account.", + "tags": [ + "manage" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" + } + }, "/manage/api/credits": { "get": { "operationId": "get_user_credits", @@ -1078,6 +1224,57 @@ "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" } }, + "/manage/api/organization/billing_portal": { + "get": { + "operationId": "get_organization_billing_portal", + "parameters": [ + { + "description": "Base64 encoded organization ID to retrieve the billing portal for", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "example": { + "has_stripe_setup": true, + "stripe_billing_url": "https://billing.stripe.com/p/session/test_123" + }, + "schema": { + "$ref": "#/components/schemas/GetOrganizationBillingPortalResponse" + } + } + }, + "description": "Billing portal URL retrieved successfully" + }, + "401": { + "description": "Not authorized" + }, + "403": { + "description": "Not authorized" + }, + "404": { + "description": "Organization not found" + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "summary": "Retrieve the Stripe billing portal URL for a specific organization", + "tags": [ + "manage" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" + } + }, "/manage/api/organization/deactivate_api_key": { "post": { "operationId": "deactivate_organization_api_key", @@ -1445,6 +1642,110 @@ "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" } }, + "/manage/api/organization/{organization_id}/api_properties": { + "patch": { + "description": "Lets an organization owner toggle API-only settings such as\ncopyright_detection_enabled. Updates only the fields explicitly present\nin the request body; absent fields are left unchanged.\n", + "operationId": "update_organization_api_properties", + "parameters": [ + { + "description": "Base64 encoded organization ID to update.", + "in": "path", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateOrganizationApiPropertiesRequest" + } + } + }, + "required": true, + "x-body-name": "update_organization_api_properties_request" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateOrganizationApiPropertiesResponse" + } + } + }, + "description": "Updated API properties." + }, + "401": { + "description": "Not authorized" + }, + "403": { + "description": "Not authorized — must be an organization owner" + }, + "404": { + "description": "Organization not found" + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "summary": "Update a single field on an organization's API properties.", + "tags": [ + "manage" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" + } + }, + "/manage/api/payment": { + "post": { + "description": "Returns a client_secret for the org's payment customer so the inline payment\nmodal can save a card without leaving the app.\n\nSoft-deprecated: the inline Elements flow was removed in the Stripe.js\neager-bundle incident (2026-05-20). New clients should use the\nstripe_payment_setup_url field on ManageApiStripeSubscriptionResponse, which\nreturns a hosted Stripe Checkout URL instead. This endpoint will be formally\ndeprecated and then removed once no callers reference it.\n", + "operationId": "create_api_payment", + "parameters": [ + { + "description": "Workspace to create the SetupIntent for. The payment method attaches to this org's Stripe customer.", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ManageApiPaymentResponse" + } + } + }, + "description": "client_secret for inline card collection." + }, + "401": { + "description": "Not authorized" + }, + "403": { + "description": "Not authorized" + } + }, + "security": [ + { + "BearerAuth": [] + } + ], + "summary": "Create a payment setup session for inline card collection.", + "tags": [ + "manage" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.manage_controller" + } + }, "/manage/api/profiles": { "get": { "operationId": "get_api_profiles", @@ -1587,6 +1888,15 @@ "get": { "operationId": "get_api_stripe_subscription", "parameters": [ + { + "description": "Workspace to set up Stripe for. Caller must be OWNER or WRITER of the org.", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + }, { "description": "Whether the subscription is intended to be used for business or personal use.", "in": "query", @@ -1629,7 +1939,18 @@ "/manage/api/subscription": { "get": { "operationId": "get_api_subscription", - "responses": { + "parameters": [ + { + "description": "Workspace to load the subscription for. The caller must be OWNER or WRITER of the org. The response shape branches on the org's type (PRIVATE / TEAM_API get recharge settings; ENTERPRISE_API does not).", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { "200": { "content": { "application/json": { @@ -1660,6 +1981,17 @@ }, "post": { "operationId": "post_api_subscription", + "parameters": [ + { + "description": "Workspace whose subscription settings to update. Caller must be OWNER or WRITER of the org.", + "in": "query", + "name": "organization_id", + "required": true, + "schema": { + "type": "string" + } + } + ], "requestBody": { "content": { "application/json": { @@ -2277,6 +2609,30 @@ "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" } }, + "/v1/.well-known/jwks.json": { + "get": { + "description": "Returns the set of Ed25519 public keys Ideogram uses to sign outbound\nwebhook payloads. Customers verify incoming webhooks by recomputing the\ncanonical signed message (`request_id\\nuser_id\\ntimestamp\\nsha256_hex(body)`)\nand checking the `X-Ideogram-Webhook-Signature` header against any key\nin this document.\n\nThe document includes the current signing key plus any keys recently\nrotated out, so signatures already in flight remain verifiable across\nrotations. Cache for up to 24 hours; refresh sooner if a signature\nfails to verify against the cached set.\n\nThis endpoint is public and unauthenticated — no API key is required.\n", + "operationId": "get_webhook_signing_jwks", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebhookSigningJwks" + } + } + }, + "description": "JSON Web Key Set with the active webhook-signing keys." + } + }, + "security": [], + "summary": "Get the public keys used to verify webhook signatures", + "tags": [ + "webhooks" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.webhooks_controller" + } + }, "/v1/edit": { "post": { "description": "Edit one or more images using a text prompt. Provide images via file upload\nor Ideogram image URLs, and describe the desired edit in your prompt.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", @@ -2334,12 +2690,96 @@ "tags": [ "generate" ], + "x-fern-examples": [ + { + "request": { + "prompt": "Change the background to a beach sunset." + }, + "response": { + "body": { + "created": "2000-01-23T04:56:07+00:00", + "data": [ + { + "prompt": "Change the background to a beach sunset.", + "resolution": "1024x1024", + "is_image_safe": true, + "seed": 12345, + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89" + } + ] + } + }, + "code-samples": [ + { + "sdk": "curl", + "code": "curl -X POST https://api.ideogram.ai/v1/edit \\\n -H \"Api-Key: \" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F images=@ \\\n -F prompt=\"Change the background to a beach sunset.\"\n" + }, + { + "sdk": "python", + "code": "import requests\n\nresponse = requests.post(\n \"https://api.ideogram.ai/v1/edit\",\n headers={\n \"Api-Key\": \"\"\n },\n data={\n \"prompt\": \"Change the background to a beach sunset.\"\n },\n files={\n \"images\": open(\"\", \"rb\"),\n }\n)\nprint(response.json())\nwith open('output.png', 'wb') as f:\n f.write(requests.get(response.json()['data'][0]['url']).content)\n" + }, + { + "sdk": "typescript", + "code": "const formData = new FormData();\nformData.append('prompt', 'Change the background to a beach sunset.');\nformData.append('images', '');\nconst response = await fetch('https://api.ideogram.ai/v1/edit', {\n method: 'POST',\n headers: { 'Api-Key': '' },\n body: formData\n});\nconst data = await response.json();\nconsole.log(data);\n" + } + ] + } + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/generations/{generation_id}": { + "get": { + "description": "Retrieves the current status of an asynchronous generation, and its results once complete. Use the `generation_id` returned by the async generation endpoint.", + "operationId": "get_generation", + "parameters": [ + { + "description": "URL-safe base64 ID of the generation returned by the async generation endpoint.", + "explode": false, + "in": "path", + "name": "generation_id", + "required": true, + "schema": { + "type": "string" + }, + "style": "simple" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerationResponse" + } + } + }, + "description": "Generation status retrieved successfully." + }, + "400": { + "description": "Invalid request ID provided." + }, + "401": { + "description": "Not authorized." + }, + "404": { + "description": "Request not found." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Poll a generation", + "tags": [ + "generate" + ], "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" } }, "/v1/ideogram-v3/edit": { "post": { - "description": "Edit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "deprecated": true, + "description": "Deprecated: use [`POST /v1/ideogram-v3/inpaint`](/api-reference/api-reference/inpaint-v3) instead. This endpoint will be removed in a future release.\n\nEdit a given image synchronously using the provided mask with Ideogram 3.0. The mask indicates which part of the image\nshould be edited, while the prompt and chosen style can further guide the edit.\n\nSupported image formats include JPEG, PNG, and WebP.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", "operationId": "post_edit_image_v3", "requestBody": { "content": { @@ -2605,7 +3045,7 @@ }, "/v1/ideogram-v3/generate-transparent": { "post": { - "description": "Generates images with transparent background synchronously based on a given prompt and optional parameters using\nthe Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio\nto allow best results with upscaler. The selected resolution is written to the response, not the upscaled final\nresolution.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "description": "Generates images with transparent background synchronously based on a given prompt and optional parameters using\nthe Ideogram 3.0 model. Images will be generated using maximum supported resolution at the specified aspect ratio\nto allow best results with upscaler. The selected resolution is written to the response, not the upscaled final\nresolution.\n\n`rendering_speed=FLASH` is not supported for transparent-background generation; the request will return a 400.\nUse `TURBO`, `DEFAULT`, or `QUALITY` instead.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", "operationId": "post_generate_image_v3_transparent", "requestBody": { "content": { @@ -2863,6 +3303,43 @@ "tags": [ "generate" ], + "x-fern-examples": [ + { + "request": { + "prompt": "A photo of a cat wearing a hat.", + "style_type": "AUTO" + }, + "response": { + "body": { + "created": "2000-01-23T04:56:07+00:00", + "data": [ + { + "prompt": "A photo of a cat wearing a hat.", + "resolution": "1024x1024", + "is_image_safe": true, + "seed": 12345, + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "style_type": "AUTO" + } + ] + } + }, + "code-samples": [ + { + "sdk": "curl", + "code": "curl -X POST https://api.ideogram.ai/v1/ideogram-v3/inpaint \\\n -H \"Api-Key: \" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F image=@ \\\n -F mask=@ \\\n -F prompt=\"A photo of a cat wearing a hat.\" \\\n -F rendering_speed=\"DEFAULT\"\n" + }, + { + "sdk": "python", + "code": "import requests\n\nresponse = requests.post(\n \"https://api.ideogram.ai/v1/ideogram-v3/inpaint\",\n headers={\n \"Api-Key\": \"\"\n },\n data={\n \"prompt\": \"A photo of a cat wearing a hat.\",\n \"rendering_speed\": \"DEFAULT\"\n },\n files={\n \"image\": open(\"\", \"rb\"),\n \"mask\": open(\"\", \"rb\"),\n }\n)\nprint(response.json())\nwith open('output.png', 'wb') as f:\n f.write(requests.get(response.json()['data'][0]['url']).content)\n" + }, + { + "sdk": "typescript", + "code": "const formData = new FormData();\nformData.append('prompt', 'A photo of a cat');\nformData.append('rendering_speed', 'TURBO');\nconst response = await fetch('https://api.ideogram.ai/v1/ideogram-v3/inpaint', {\n method: 'POST',\n headers: { 'Api-Key': '' },\n body: formData\n});\nconst data = await response.json();\nconsole.log(data);\n" + } + ] + } + ], "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" } }, @@ -3427,13 +3904,31 @@ "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" } }, - "/v1/ideogram-v4/generate": { + "/v1/ideogram-v4/async/generate": { "post": { - "description": "Generates images synchronously using the Ideogram 4.0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", - "operationId": "post_generate_image_v4", + "description": "Accepts an Ideogram 4.0 generation request for asynchronous processing and\nreturns immediately with a generation_id. The generated images are POSTed to\nthe supplied `webhook_url` once ready, in a payload that mirrors the\nsynchronous response with an added generation_id for correlation.\n", + "operationId": "post_generate_image_v4_async", + "parameters": [ + { + "explode": true, + "in": "query", + "name": "webhook_url", + "required": true, + "schema": { + "$ref": "#/components/schemas/WebhookUrl" + }, + "style": "form" + } + ], "requestBody": { "content": { "multipart/form-data": { + "encoding": { + "json_prompt": { + "contentType": "application/json", + "style": "form" + } + }, "schema": { "$ref": "#/components/schemas/GenerateImageRequestV4" } @@ -3453,11 +3948,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ImageGenerationResponseV4" + "$ref": "#/components/schemas/AsyncImageGenerationResponseV4" } } }, - "description": "Image(s) generated successfully." + "description": "Request accepted for asynchronous delivery." }, "400": { "description": "Invalid input provided." @@ -3479,67 +3974,903 @@ "description": "Too many requests." } }, - "summary": "Generate with Ideogram 4.0", + "summary": "Generate with Ideogram 4.0 asynchronously via webhook", "tags": [ "generate" ], "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" } - } - }, - "components": { - "schemas": { - "GenerateImageRequestV4": { - "properties": { - "prompt": { - "description": "The text prompt for image generation.", - "type": "string" - }, - "seed": { - "description": "Random seed for reproducibility.", - "nullable": true, - "type": "integer" - }, - "magic_prompt_option": { - "$ref": "#/components/schemas/MagicPromptOption" - }, - "custom_model_uri": { - "description": "A custom model URI in the format model//version/.\nWhen provided, the model version and style will be resolved from this URI.\n", - "example": "model/my-custom-model/version/0", - "type": "string" + }, + "/v1/ideogram-v4/async/generate-design": { + "post": { + "description": "Accepts an Ideogram 4.0 HTML design request for asynchronous processing and\nreturns immediately with a request_id. The generated design is POSTed to the\nsupplied `webhook_url` once ready.\n", + "operationId": "post_generate_design_v4_async", + "parameters": [ + { + "explode": true, + "in": "query", + "name": "webhook_url", + "required": true, + "schema": { + "$ref": "#/components/schemas/WebhookUrl" + }, + "style": "form" } - }, - "required": [ - "prompt" ], - "type": "object" - }, - "DescribeResponse": { - "description": "The response for a describe request encapsulates a list of descriptions.", - "example": { - "descriptions": [ - { - "text": "A meticulously illustrated cat with striped patterns, sitting upright. The cat's eyes are a captivating shade of yellow, and it appears to be gazing intently at something. The background consists of abstract, swirling patterns in shades of black, white, and beige, creating an almost fluid or wavy appearance. The cat is positioned in the foreground, with the background elements fading into the distance, giving a sense of depth to the image." + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/GenerateDesignRequestV4" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateDesignRequestV4" + } } - ] + }, + "description": "A request to generate an editable design with Ideogram 4.0 HTML.", + "required": true, + "x-body-name": "body" }, - "properties": { - "descriptions": { - "description": "A collection of descriptions for given content.", - "items": { - "$ref": "#/components/schemas/Description" + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AsyncImageGenerationResponseV4" + } + } }, - "type": "array" + "description": "Request accepted for asynchronous delivery." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." } }, - "title": "DescribeResponse", - "type": "object" - }, - "DescribeRequest": { - "properties": { - "image_file": { - "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", - "format": "binary", + "summary": "Generate an editable V4 HTML design asynchronously via webhook", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/async/image-to-image": { + "post": { + "description": "Accepts an Ideogram 4.0 image-to-image request for asynchronous processing\nand returns immediately with a request_id. The generated images are POSTed\nto the supplied `webhook_url` once ready.\n", + "operationId": "post_generate_image_v4_im2_im_async", + "parameters": [ + { + "explode": true, + "in": "query", + "name": "webhook_url", + "required": true, + "schema": { + "$ref": "#/components/schemas/WebhookUrl" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4Im2Im" + } + } + }, + "description": "A request to generate an image with Ideogram 4.0 using an initial image.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AsyncImageGenerationResponseV4" + } + } + }, + "description": "Request accepted for asynchronous delivery." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Image-to-image with Ideogram 4.0 asynchronously via webhook", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/describe": { + "post": { + "description": "Describe an image with Ideogram 4.0 and return a structured\n`V4JsonPrompt`. The returned `json_prompt` is a working JSON prompt\nthat can be passed directly as `json_prompt` to the\n`/v1/ideogram-v4/generate` family of endpoints.\n\nSupported image formats include JPEG, PNG, and WebP.\n", + "operationId": "post_describe_v4", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/DescribeRequestV4" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DescribeResponseV4" + } + } + }, + "description": "Structured V4 prompt generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageSafetyError" + } + } + }, + "description": "Image failed the safety check." + }, + "429": { + "description": "Too many requests." + }, + "503": { + "description": "Took too long to finish." + } + }, + "summary": "Describe with Ideogram 4.0", + "tags": [ + "vision" + ], + "x-fern-examples": [ + { + "code-samples": [ + { + "sdk": "curl", + "code": "curl -X POST https://api.ideogram.ai/v1/ideogram-v4/describe \\\n -H \"Api-Key: \" \\\n -H \"Content-Type: multipart/form-data\" \\\n -F image_file=@\n" + } + ] + } + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.vision_controller" + } + }, + "/v1/ideogram-v4/generate": { + "post": { + "description": "Generates images synchronously using the Ideogram 4.0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "operationId": "post_generate_image_v4", + "requestBody": { + "content": { + "multipart/form-data": { + "encoding": { + "json_prompt": { + "contentType": "application/json", + "style": "form" + } + }, + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4" + } + } + }, + "description": "A request to generate an image with Ideogram 4.0.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageGenerationResponseV4" + } + } + }, + "description": "Image(s) generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Generate with Ideogram 4.0", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/generate-design": { + "post": { + "description": "Experimental prototype endpoint for generating an editable V4 HTML design from a prompt.\n\nOptionally accepts inspiration reference images to guide transferable visual style. Inspiration images are design/style references only and are not edit targets.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "operationId": "post_generate_design_v4", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/GenerateDesignRequestV4" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateDesignRequestV4" + } + } + }, + "description": "A request to generate an editable design with Ideogram 4.0 HTML.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/postGenerateDesignV4_200_response" + } + }, + "image/png": { + "schema": { + "format": "binary", + "type": "string" + } + }, + "text/html": { + "schema": { + "type": "string" + } + } + }, + "description": "Design(s) generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Generate an editable design with Ideogram 4.0 HTML", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/generate/stable": { + "post": { + "description": "Generates images synchronously using a pinned stable build of the\nIdeogram 4.0 model. This endpoint is intentionally minimal: it accepts\nonly a prompt (and optional seed), pins the underlying model URI, and\nlets the server pick the output resolution automatically.\n\nImages links are available for a limited period of time; if you would\nlike to keep the image, you must download it.\n", + "operationId": "post_generate_image_v4_stable", + "requestBody": { + "content": { + "multipart/form-data": { + "encoding": { + "json_prompt": { + "contentType": "application/json", + "style": "form" + } + }, + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4Stable" + } + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4Stable" + } + } + }, + "description": "A request to generate an image with the stable Ideogram 4.0 build.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageGenerationResponseV4" + } + } + }, + "description": "Image(s) generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Generate with Ideogram 4.0 (stable model)", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/image-to-image": { + "post": { + "description": "Generates images synchronously using the Ideogram 4.0 model with an initial image as input.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "operationId": "post_generate_image_v4_im2_im", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/GenerateImageRequestV4Im2Im" + } + } + }, + "description": "A request to generate an image with Ideogram 4.0 using an initial image.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageGenerationResponseV4ImageToImage" + } + } + }, + "description": "Image(s) generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Image-to-image with Ideogram 4.0", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/ideogram-v4/magic-prompt": { + "post": { + "description": "Transforms a basic prompt into an enhanced Ideogram 4.0 magic prompt.\nThe magic prompt model version is fixed; callers cannot select it.\nWhen `aspect_ratio` is `AUTO` (the default), the model selects the most\nsuitable aspect ratio for the prompt and returns it in the response.\n", + "operationId": "post_magic_prompt_v4", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MagicPromptV4Request" + } + } + }, + "description": "A request to generate an Ideogram 4.0 magic prompt.", + "required": true, + "x-body-name": "magic_prompt_v4_request" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MagicPromptV4Response" + } + } + }, + "description": "Magic prompt generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized to generate magic prompts." + }, + "429": { + "description": "Too many requests." + }, + "500": { + "description": "Internal server error." + } + }, + "summary": "Generate a Magic Prompt with Ideogram 4.0", + "tags": [ + "prompt" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.prompt_controller" + } + }, + "/v1/ideogram-v4/remix": { + "post": { + "description": "Remix an image synchronously using the Ideogram 4.0 model with an initial image and a prompt.\n\nMirrors `/v1/ideogram-v3/remix` semantics (including `image_weight` for how strongly the\noutput should resemble the input image) but routes the request through the V_4_0 model.\n\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.\n", + "operationId": "post_remix_image_v4", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/RemixImageRequestV4" + } + } + }, + "description": "A request to remix an image with Ideogram 4.0.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageGenerationResponseV4" + } + } + }, + "description": "Image(s) generated successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Prompt failed the safety check." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Remix with Ideogram 4.0", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + }, + "/v1/remove-background": { + "post": { + "description": "Remove the background of a given image synchronously. The foreground subject\nis identified and returned on a transparent background. Supported image formats include JPEG,\nPNG, and WebP.\nImage links are available for a limited period of time; if you would like to keep the image,\nyou must download it.\n", + "operationId": "post_remove_background", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/RemoveBackgroundRequest" + } + } + }, + "description": "A request to remove the background of an image.", + "required": true, + "x-body-name": "body" + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RemoveBackgroundResponse" + } + } + }, + "description": "Background removed successfully." + }, + "400": { + "description": "Invalid input provided." + }, + "401": { + "description": "Not authorized to remove background." + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GenerateImageSafetyError" + } + } + }, + "description": "Initial image failed the safety checks." + }, + "429": { + "description": "Too many requests." + } + }, + "summary": "Remove Background", + "tags": [ + "generate" + ], + "x-openapi-router-controller": "external_api.generated.openapi.controllers.generate_controller" + } + } + }, + "components": { + "schemas": { + "GenerateImageRequestV4": { + "description": "Request body for Ideogram 4.0 image generation. Supply exactly one of\n`text_prompt` or `json_prompt`. When `text_prompt` is supplied,\nmagic-prompt is applied automatically. When `json_prompt` is supplied,\nmagic-prompt is skipped and the structured prompt is consumed\ndirectly.\n", + "properties": { + "text_prompt": { + "description": "A natural-language prompt for image generation. When supplied,\nmagic-prompt is enabled automatically. Mutually exclusive with\n`json_prompt`.\n", + "type": "string" + }, + "json_prompt": { + "allOf": [ + { + "$ref": "#/components/schemas/V4JsonPrompt" + } + ], + "description": "A structured prompt that conforms to the Ideogram 4.0 JSON\ncontract. When supplied, magic-prompt is disabled and the\nstructured prompt is consumed by the diffusion model directly.\nMutually exclusive with `text_prompt`.\n" + }, + "seed": { + "description": "Random seed for reproducibility.", + "nullable": true, + "type": "integer" + }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use\nfor this request. Honored when `text_prompt` is supplied. Ignored\nwhen `json_prompt` is supplied.\n", + "type": "string" + }, + "custom_model_uri": { + "description": "A custom model URI in the format model//version/.\nWhen provided, the model version and style will be resolved from this URI.\n", + "example": "model/my-custom-model/version/0", + "type": "string" + }, + "resolution": { + "$ref": "#/components/schemas/ResolutionV4" + }, + "rendering_speed": { + "allOf": [ + { + "$ref": "#/components/schemas/RenderingSpeed" + } + ], + "description": "The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`\nis coming soon; requests with `rendering_speed=FLASH` currently\nreturn a 400.\n" + }, + "enable_copyright_detection": { + "description": "Optional. Opt this request into post-generation copyright detection (Hive likeness + logo\nchecks). The effective gate is the OR of this field and the organization's\n`copyright_detection_enabled` setting on `/api`. See GenerateImageRequestV3 for details.\n", + "nullable": true, + "type": "boolean" + } + }, + "type": "object" + }, + "GenerateImageRequestV4Stable": { + "description": "Request body for the stable Ideogram 4.0 endpoint. Supply exactly one\nof `text_prompt` or `json_prompt`. The model URI is pinned\nserver-side. When `resolution` is omitted, the server chooses an\naspect ratio automatically.\n", + "properties": { + "text_prompt": { + "description": "A natural-language prompt for image generation. When supplied,\nmagic-prompt is enabled automatically. Mutually exclusive with\n`json_prompt`.\n", + "type": "string" + }, + "json_prompt": { + "allOf": [ + { + "$ref": "#/components/schemas/V4JsonPrompt" + } + ], + "description": "A structured prompt that conforms to the Ideogram 4.0 JSON\ncontract. When supplied, magic-prompt is disabled and the\nstructured prompt is consumed by the diffusion model directly.\nMutually exclusive with `text_prompt`.\n" + }, + "seed": { + "description": "Random seed for reproducibility.", + "nullable": true, + "type": "integer" + }, + "resolution": { + "allOf": [ + { + "$ref": "#/components/schemas/ResolutionV4" + } + ], + "description": "Optional. When supplied, the image is generated at this\nresolution. When omitted, the server picks an aspect ratio\nautomatically based on the prompt.\n" + }, + "version": { + "description": "Optional. Selects a specific pinned stable build. When omitted,\nthe default stable model URI is used. When set to `stable_may29`,\nthe request is routed to the May 29th stable build.\n", + "enum": [ + "stable_may29" + ], + "nullable": true, + "type": "string" + } + }, + "type": "object" + }, + "GenerateImageRequestV4Im2Im": { + "properties": { + "image": { + "description": "The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported.", + "format": "binary", + "type": "string" + }, + "prompt": { + "description": "An optional text prompt to guide the generation.", + "type": "string" + }, + "seed": { + "$ref": "#/components/schemas/Seed" + }, + "magic_prompt_option": { + "$ref": "#/components/schemas/MagicPromptOption" + }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, + "resolution": { + "$ref": "#/components/schemas/ResolutionV4ImageToImage" + }, + "rendering_speed": { + "allOf": [ + { + "$ref": "#/components/schemas/RenderingSpeed" + } + ], + "description": "The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`\nis coming soon; requests with `rendering_speed=FLASH` currently\nreturn a 400.\n" + }, + "enable_copyright_detection": { + "description": "Optional. Opt this request into post-generation copyright detection (Hive likeness + logo\nchecks). See GenerateImageRequestV3 for details.\n", + "nullable": true, + "type": "boolean" + } + }, + "required": [ + "image" + ], + "type": "object" + }, + "RemixImageRequestV4": { + "properties": { + "image": { + "description": "The initial image binary (max 10MB); only JPEG, WebP and PNG formats are supported.", + "format": "binary", + "type": "string" + }, + "text_prompt": { + "description": "The text prompt that guides the remix.", + "type": "string" + }, + "image_weight": { + "description": "Optional. How strongly the output should resemble the input image. Higher values keep\nthe input image's structure; lower values allow the prompt to drive the output more.\nWhen omitted, the weight is chosen automatically from the edit instruction; supplying\na value overrides that automatic choice.\n", + "maximum": 100, + "minimum": 1, + "type": "integer" + }, + "resolution": { + "$ref": "#/components/schemas/ResolutionV4" + }, + "rendering_speed": { + "$ref": "#/components/schemas/RenderingSpeed" + }, + "enable_copyright_detection": { + "description": "Optional. Opt this request into post-generation copyright detection (Hive likeness + logo\nchecks). See GenerateImageRequestV3 for details.\n", + "nullable": true, + "type": "boolean" + } + }, + "required": [ + "image", + "text_prompt" + ], + "type": "object" + }, + "GenerateDesignRequestV4": { + "properties": { + "prompt": { + "description": "The text prompt for editable design generation.", + "type": "string" + }, + "seed": { + "description": "Random seed for reproducibility.", + "nullable": true, + "type": "integer" + }, + "magic_prompt_option": { + "$ref": "#/components/schemas/MagicPromptOption" + }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, + "resolution": { + "$ref": "#/components/schemas/ResolutionV4Layout" + }, + "rendering_speed": { + "allOf": [ + { + "$ref": "#/components/schemas/RenderingSpeed" + } + ], + "description": "The rendering speed to use. For Ideogram V4, `rendering_speed=FLASH`\nis coming soon; requests with `rendering_speed=FLASH` currently\nreturn a 400.\n" + }, + "inspiration_reference_images": { + "description": "Experimental. Up to 4 static inspiration images used as transferable visual style references for V4 layout-to-image design. Images are not edit targets and are not inserted into the generated HTML layout. Supported formats are JPEG, PNG, and WebP (max size 10MB each). Animated images are not supported.\n", + "items": { + "format": "binary", + "type": "string" + }, + "maxItems": 4, + "type": "array" + }, + "inspiration_reference_model": { + "default": "claude-sonnet-4-6", + "description": "Experimental. Model to use for the inspiration vision prepass.", + "enum": [ + "claude-sonnet-4-6", + "claude-opus-4-6", + "claude-opus-4-7" + ], + "nullable": true, + "type": "string" + }, + "artifact_generation_model": { + "default": "claude-sonnet-4-6", + "description": "Experimental. Model to use for the HTML/layout and base-plate handoff generation call.", + "enum": [ + "claude-sonnet-4-6", + "claude-opus-4-6", + "claude-opus-4-7" + ], + "nullable": true, + "type": "string" + }, + "layout2image_variant": { + "description": "Experimental. Staging only. Select a v4 layout-to-image pipeline variant.\nOmit for the default v4l2i path. Rejected on production.\n", + "enum": [ + "opus_4_7", + "separate_image_layer", + "bbox_aware" + ], + "nullable": true, + "type": "string" + }, + "response_type": { + "default": "layered", + "description": "layered (default): full editable design payload with text layers and HTML.\nurl: JSON with an expiring link to the final composited cover image.\nbinary: raw PNG bytes of the final composited cover image (Content-Type image/png).\nhtml: raw HTML document of the generated layout (Content-Type text/html).\n", + "enum": [ + "layered", + "url", + "binary", + "html" + ], + "nullable": true, + "type": "string" + } + }, + "required": [ + "prompt" + ], + "type": "object" + }, + "DescribeResponse": { + "description": "The response for a describe request encapsulates a list of descriptions.", + "example": { + "descriptions": [ + { + "text": "A meticulously illustrated cat with striped patterns, sitting upright. The cat's eyes are a captivating shade of yellow, and it appears to be gazing intently at something. The background consists of abstract, swirling patterns in shades of black, white, and beige, creating an almost fluid or wavy appearance. The cat is positioned in the foreground, with the background elements fading into the distance, giving a sense of depth to the image." + } + ] + }, + "properties": { + "descriptions": { + "description": "A collection of descriptions for given content.", + "items": { + "$ref": "#/components/schemas/Description" + }, + "type": "array" + } + }, + "title": "DescribeResponse", + "type": "object" + }, + "DescribeRequest": { + "properties": { + "image_file": { + "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", "type": "string" }, "describe_model_version": { @@ -3551,6 +4882,88 @@ ], "type": "object" }, + "DescribeRequestV4": { + "properties": { + "image_file": { + "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + }, + "include_bbox": { + "default": true, + "description": "When true (default), the response preserves bounding boxes on each\nelement so the prompt can be pasted into `/v1/ideogram-v4/generate`\nas `json_prompt` and reproduce the source layout. Set to false to\ndrop bounding boxes and let the sampler place elements freely.\n", + "type": "boolean" + }, + "include_style_descriptions": { + "default": false, + "description": "When false (default), the response omits `json_prompt.style_description`\nto match the contract used by `/v1/ideogram-v4/generate`'s `json_prompt`\ninput. Set to true to surface the captioner's source-image style\ndescription in the response.\n", + "type": "boolean" + }, + "include_tags": { + "default": false, + "description": "When false (default), the response omits `json_prompt.tags` to match\nthe contract used by `/v1/ideogram-v4/generate`'s `json_prompt`\ninput. Set to true to surface the captioner's free-form tags on the\nresponse.\n", + "type": "boolean" + } + }, + "required": [ + "image_file" + ], + "type": "object" + }, + "DescribeResponseV4": { + "description": "The response for an Ideogram 4.0 describe request. The `json_prompt`\nfield is a structured `V4JsonPrompt` that can be passed back as\n`json_prompt` to the `/v1/ideogram-v4/generate` family of endpoints.\n", + "example": { + "json_prompt": { + "high_level_description": "high_level_description", + "style_description": { + "photo": "photo", + "art_style": "art_style", + "medium": "medium", + "aesthetics": "aesthetics", + "lighting": "lighting" + }, + "compositional_deconstruction": { + "background": "background", + "elements": [ + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + }, + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + } + ] + }, + "tags": [ + "tags", + "tags" + ] + } + }, + "properties": { + "json_prompt": { + "$ref": "#/components/schemas/V4JsonPrompt" + } + }, + "required": [ + "json_prompt" + ], + "title": "DescribeResponseV4", + "type": "object" + }, "EditImageRequest": { "properties": { "image_file": { @@ -3574,6 +4987,10 @@ "magic_prompt_option": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "num_images": { "$ref": "#/components/schemas/NumImages" }, @@ -3639,6 +5056,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "negative_prompt": { "description": "Description of what to exclude from an image. Descriptions in the prompt take precedence\nto descriptions in the negative prompt.\n", "example": "brush strokes, painting", @@ -3700,6 +5121,11 @@ "type": "string" }, "type": "array" + }, + "enable_copyright_detection": { + "description": "Optional. Opt this request into post-generation copyright detection (Hive likeness + logo\nchecks). The effective gate is the OR of this field and the organization's\n`copyright_detection_enabled` setting on `/api`: if the org has it on, this is ignored;\nif the org has it off, setting this `true` enables detection for this request only.\nAdds detection latency. Flagged images come back with `is_image_safe: false`.\n", + "nullable": true, + "type": "boolean" } }, "required": [ @@ -3734,6 +5160,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "negative_prompt": { "description": "Description of what to exclude from a graphic. Descriptions in the prompt take precedence\nto descriptions in the negative prompt.\n", "example": "brush strokes, painting", @@ -3860,6 +5290,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "negative_prompt": { "description": "Description of what to exclude from a design. Descriptions in the prompt take precedence\nto descriptions in the negative prompt.\n", "example": "brush strokes, painting", @@ -4049,6 +5483,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "negative_prompt": { "description": "Description of what to exclude from an image. Descriptions in the prompt take precedence\nto descriptions in the negative prompt.\n", "example": "brush strokes, painting", @@ -4106,6 +5544,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "negative_prompt": { "description": "Description of what to exclude from an image. Descriptions in the prompt take precedence\nto descriptions in the negative prompt.\n", "example": "brush strokes, painting", @@ -4186,6 +5628,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "num_images": { "$ref": "#/components/schemas/NumImages" }, @@ -4277,6 +5723,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "resolution": { "$ref": "#/components/schemas/ResolutionV3" }, @@ -4310,6 +5760,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "num_images": { "$ref": "#/components/schemas/NumImages" }, @@ -4400,6 +5854,10 @@ "magic_prompt": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "type": "string" + }, "num_images": { "$ref": "#/components/schemas/NumImages" }, @@ -4428,199 +5886,643 @@ } }, "required": [ - "image", - "prompt" + "image", + "prompt" + ], + "type": "object" + }, + "RemoveBackgroundRequest": { + "properties": { + "image": { + "description": "The image whose background is being removed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + } + }, + "required": [ + "image" + ], + "type": "object" + }, + "RemoveBackgroundResponse": { + "description": "The response containing the foreground image with the background removed.\nImage links are available for a limited period of time; if you would like to keep the image, you must download it.", + "example": { + "created": "2000-01-23T04:56:07+00:00", + "data": [ + { + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + } + ] + }, + "properties": { + "created": { + "description": "The time the request was created.", + "format": "date-time", + "type": "string" + }, + "data": { + "description": "A list containing the single foreground image. The endpoint always returns exactly one entry.", + "items": { + "$ref": "#/components/schemas/RemoveBackgroundImageObject" + }, + "type": "array" + } + }, + "required": [ + "created", + "data" + ], + "title": "RemoveBackgroundResponse", + "type": "object" + }, + "RemoveBackgroundImageObject": { + "properties": { + "url": { + "description": "The direct link to the foreground image. Empty when the image fails safety checks.", + "example": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "format": "uri", + "nullable": true, + "title": "url", + "type": "string" + }, + "is_image_safe": { + "description": "Whether the foreground image passes safety checks. If false, the url field will be empty.", + "title": "is_image_safe", + "type": "boolean" + } + }, + "required": [ + "is_image_safe" + ], + "title": "RemoveBackgroundImageObject", + "type": "object" + }, + "InternalTestingRequest": { + "properties": { + "x_position": { + "nullable": true, + "type": "integer" + }, + "image_file": { + "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + }, + "another_image_file": { + "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + }, + "some_text": { + "type": "string" + }, + "nested_object": { + "$ref": "#/components/schemas/InternalTestingNestedObject" + }, + "nested_object_required_fields": { + "$ref": "#/components/schemas/InternalTestingNestedObjectRequiredFields" + }, + "date_type_field": { + "format": "date", + "type": "string" + }, + "required_date_type_field": { + "format": "date", + "type": "string" + }, + "date_time_type_field": { + "format": "date-time", + "type": "string" + }, + "repeated_primitive_field": { + "items": { + "type": "string" + }, + "type": "array" + }, + "repeated_complex_field": { + "items": { + "$ref": "#/components/schemas/InternalTestingNestedObject" + }, + "type": "array" + }, + "enum_type_field": { + "$ref": "#/components/schemas/InternalTestingEnumField" + } + }, + "required": [ + "required_date_type_field" + ], + "type": "object" + }, + "InternalTestingEnumField": { + "enum": [ + "EIN", + "ZWEI", + "DREI" + ], + "title": "InternalTestingEnumField", + "type": "string" + }, + "InternalTestingNestedObject": { + "properties": { + "prop_one": { + "title": "prop_one", + "type": "string" + }, + "prop_two": { + "title": "prop_two", + "type": "string" + } + }, + "title": "InternalTestingNestedObject", + "type": "object" + }, + "InternalTestingNestedObjectRequiredFields": { + "properties": { + "prop_one": { + "title": "prop_one", + "type": "string" + }, + "prop_two": { + "title": "prop_two", + "type": "string" + } + }, + "required": [ + "prop_one", + "prop_two" + ], + "title": "InternalTestingNestedObjectRequiredFields", + "type": "object" + }, + "RemixImageRequest": { + "description": "A request to generate an image from a source image and a provided caption, provided images are cropped to match the chosen output aspect ratio.", + "properties": { + "image_request": { + "$ref": "#/components/schemas/InitialImageRequest" + }, + "image_file": { + "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + } + }, + "required": [ + "image_file", + "image_request" + ], + "type": "object" + }, + "ReframeImageRequest": { + "properties": { + "image_file": { + "description": "The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", + "format": "binary", + "type": "string" + }, + "resolution": { + "$ref": "#/components/schemas/Resolution" + }, + "model": { + "$ref": "#/components/schemas/ModelEnum" + }, + "num_images": { + "$ref": "#/components/schemas/NumImages" + }, + "seed": { + "$ref": "#/components/schemas/Seed" + }, + "style_type": { + "$ref": "#/components/schemas/StyleType" + } + }, + "required": [ + "image_file", + "model", + "resolution" ], "type": "object" }, - "InternalTestingRequest": { + "UpscaleImageRequest": { "properties": { - "x_position": { - "nullable": true, - "type": "integer" + "image_request": { + "$ref": "#/components/schemas/UpscaleInitialImageRequest" }, "image_file": { "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", "format": "binary", "type": "string" - }, - "another_image_file": { - "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", - "format": "binary", + } + }, + "required": [ + "image_file", + "image_request" + ], + "type": "object" + }, + "ImageRequest": { + "example": { + "aspect_ratio": "ASPECT_10_16", + "magic_prompt_option": "AUTO", + "model": "V_2", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset." + }, + "properties": { + "prompt": { + "description": "The prompt to use to generate the image.", + "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", "type": "string" }, - "some_text": { - "type": "string" + "aspect_ratio": { + "$ref": "#/components/schemas/AspectRatio" }, - "nested_object": { - "$ref": "#/components/schemas/InternalTestingNestedObject" + "model": { + "$ref": "#/components/schemas/ModelEnum" }, - "nested_object_required_fields": { - "$ref": "#/components/schemas/InternalTestingNestedObjectRequiredFields" + "magic_prompt_option": { + "$ref": "#/components/schemas/MagicPromptOption" }, - "date_type_field": { - "format": "date", + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", "type": "string" }, - "required_date_type_field": { - "format": "date", - "type": "string" + "magic_prompt_version": { + "$ref": "#/components/schemas/MagicPromptVersionEnum" }, - "date_time_type_field": { - "format": "date-time", + "seed": { + "description": "Random seed. Set for reproducible generation.", + "example": 12345, + "maximum": 2147483647, + "minimum": 0, + "title": "Seed", + "type": "integer" + }, + "style_type": { + "$ref": "#/components/schemas/StyleType" + }, + "negative_prompt": { + "description": "Only available for model versions V_1, V_1_TURBO, V_2 and V_2_TURBO. Description of what to exclude from an image. Descriptions in the prompt take precedence to descriptions in the negative prompt.", + "example": "brush strokes, painting", "type": "string" }, - "repeated_primitive_field": { - "items": { - "type": "string" - }, - "type": "array" + "num_images": { + "default": 1, + "description": "The number of images to generate.", + "maximum": 8, + "minimum": 1, + "title": "NumImages", + "type": "integer" }, - "repeated_complex_field": { - "items": { - "$ref": "#/components/schemas/InternalTestingNestedObject" - }, - "type": "array" + "resolution": { + "$ref": "#/components/schemas/Resolution" }, - "enum_type_field": { - "$ref": "#/components/schemas/InternalTestingEnumField" + "color_palette": { + "$ref": "#/components/schemas/ColorPaletteWithPresetNameOrMembers" } }, "required": [ - "required_date_type_field" + "prompt" ], + "title": "ImageRequest", "type": "object" }, - "InternalTestingEnumField": { - "enum": [ - "EIN", - "ZWEI", - "DREI" + "InitialImageRequest": { + "allOf": [ + { + "$ref": "#/components/schemas/ImageRequest" + } ], - "title": "InternalTestingEnumField", - "type": "string" + "description": "A request to generate a new image using a provided image and a prompt.", + "example": { + "aspect_ratio": "ASPECT_10_16", + "magic_prompt_option": "ON", + "model": "V_2", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "image_weight": 50 + }, + "properties": { + "image_weight": { + "default": 50, + "example": 50, + "maximum": 100, + "minimum": 1, + "type": "integer" + } + }, + "title": "InitialImageRequest", + "type": "object" }, - "InternalTestingNestedObject": { + "UpscaleInitialImageRequest": { + "description": "A request to upscale a provided image with the help of an optional prompt.", "properties": { - "prop_one": { - "title": "prop_one", + "prompt": { + "description": "An optional prompt to guide the upscale", + "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "title": "prompt", "type": "string" }, - "prop_two": { - "title": "prop_two", + "resemblance": { + "default": 50, + "example": 50, + "maximum": 100, + "minimum": 1, + "title": "resemblance", + "type": "integer" + }, + "detail": { + "default": 50, + "example": 50, + "maximum": 100, + "minimum": 1, + "title": "detail", + "type": "integer" + }, + "magic_prompt_option": { + "$ref": "#/components/schemas/MagicPromptOption" + }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "title": "magic_prompt_system_prompt_config_id", "type": "string" + }, + "magic_prompt_version": { + "$ref": "#/components/schemas/MagicPromptVersionEnum" + }, + "num_images": { + "default": 1, + "description": "The number of images to generate.", + "maximum": 8, + "minimum": 1, + "title": "NumImages", + "type": "integer" + }, + "seed": { + "description": "Random seed. Set for reproducible generation.", + "example": 12345, + "maximum": 2147483647, + "minimum": 0, + "title": "Seed", + "type": "integer" } }, - "title": "InternalTestingNestedObject", + "title": "UpscaleInitialImageRequest", "type": "object" }, - "InternalTestingNestedObjectRequiredFields": { + "GenerateImageResponse": { + "description": "The response which contains information about the generated image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "example": { + "data": [ + { + "style_type": "REALISTIC", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1024x1024", + "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "is_image_safe": true + }, + { + "style_type": "REALISTIC", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1024x1024", + "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "is_image_safe": true + } + ], + "created": "2000-01-23T04:56:07+00:00", + "request_id": "request_id" + }, "properties": { - "prop_one": { - "title": "prop_one", + "request_id": { + "description": "URL-safe base64 ID of the sampling request. Present when the caller\nsupplied `webhook_url` and the request was accepted for async\ndelivery; in that case `data` is omitted and the generated images\nwill be POSTed to the customer's `webhook_url` when ready.\n", + "title": "request_id", "type": "string" }, - "prop_two": { - "title": "prop_two", + "created": { + "description": "The time the request was created.", + "format": "date-time", + "title": "created", "type": "string" + }, + "data": { + "description": "A list of ImageObjects that contain the generated image(s).", + "items": { + "$ref": "#/components/schemas/ImageObject" + }, + "title": "data", + "type": "array" } }, - "required": [ - "prop_one", - "prop_two" - ], - "title": "InternalTestingNestedObjectRequiredFields", - "type": "object" - }, - "RemixImageRequest": { - "description": "A request to generate an image from a source image and a provided caption, provided images are cropped to match the chosen output aspect ratio.", + "required": [ + "created" + ], + "title": "GenerateImageResponse", + "type": "object" + }, + "ImageGenerationResponseV3": { + "description": "The response which contains information about the generated image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "example": { + "data": [ + { + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1280x800", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + }, + { + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1280x800", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + } + ], + "created": "2000-01-23T04:56:07+00:00" + }, "properties": { - "image_request": { - "$ref": "#/components/schemas/InitialImageRequest" - }, - "image_file": { - "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", - "format": "binary", + "created": { + "description": "The time the request was created.", + "format": "date-time", + "title": "created", "type": "string" + }, + "data": { + "description": "A list of ImageObjects that contain the generated image(s).", + "items": { + "$ref": "#/components/schemas/ImageGenerationObjectV3" + }, + "title": "data", + "type": "array" } }, "required": [ - "image_file", - "image_request" + "created", + "data" ], + "title": "ImageGenerationResponseV3", "type": "object" }, - "ReframeImageRequest": { + "ImageGenerationObjectV3": { + "example": { + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1280x800", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + }, "properties": { - "image_file": { - "description": "The image being reframed (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", - "format": "binary", + "url": { + "description": "The direct link to the image generated.", + "example": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "format": "uri", + "nullable": true, + "title": "url", + "type": "string" + }, + "prompt": { + "description": "The prompt used for the generation. This may be different from the original prompt.", + "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "title": "prompt", "type": "string" }, "resolution": { - "$ref": "#/components/schemas/Resolution" + "$ref": "#/components/schemas/ResolutionV3" }, - "model": { - "$ref": "#/components/schemas/ModelEnum" + "upscaled_resolution": { + "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", + "example": "4096x4096", + "pattern": "^\\d{2,5}x\\d{2,5}$", + "title": "FreeformResolution", + "type": "string" }, - "num_images": { - "$ref": "#/components/schemas/NumImages" + "is_image_safe": { + "description": "Whether this request passes safety checks. If false, the url field will be empty.", + "title": "is_image_safe", + "type": "boolean" }, "seed": { - "$ref": "#/components/schemas/Seed" + "description": "Random seed. Set for reproducible generation.", + "example": 12345, + "maximum": 2147483647, + "minimum": 0, + "title": "Seed", + "type": "integer" }, "style_type": { - "$ref": "#/components/schemas/StyleType" + "$ref": "#/components/schemas/StyleTypeV3" } }, "required": [ - "image_file", - "model", - "resolution" + "is_image_safe", + "prompt", + "resolution", + "seed" ], + "title": "ImageGenerationObjectV3", "type": "object" }, - "UpscaleImageRequest": { + "V1EditImagesResponse": { + "description": "The response which contains information about the edited image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "example": { + "data": [ + { + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "4096x4096", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + }, + { + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "4096x4096", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + } + ], + "created": "2000-01-23T04:56:07+00:00" + }, "properties": { - "image_request": { - "$ref": "#/components/schemas/UpscaleInitialImageRequest" - }, - "image_file": { - "description": "An image binary (max size 10MB); only JPEG, WebP and PNG formats are supported at this time.", - "format": "binary", + "created": { + "description": "The time the request was created.", + "format": "date-time", + "title": "created", "type": "string" + }, + "data": { + "description": "A list of ImageObjects that contain the edited image(s).", + "items": { + "$ref": "#/components/schemas/V1EditImageObject" + }, + "title": "data", + "type": "array" } }, "required": [ - "image_file", - "image_request" + "created", + "data" ], + "title": "V1EditImagesResponse", "type": "object" }, - "ImageRequest": { + "V1EditImageObject": { "example": { - "aspect_ratio": "ASPECT_10_16", - "magic_prompt_option": "AUTO", - "model": "V_2", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset." + "style_type": "GENERAL", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "4096x4096", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true }, "properties": { - "prompt": { - "description": "The prompt to use to generate the image.", - "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "url": { + "description": "The direct link to the image generated.", + "example": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "format": "uri", + "nullable": true, + "title": "url", "type": "string" }, - "aspect_ratio": { - "$ref": "#/components/schemas/AspectRatio" + "prompt": { + "description": "The prompt used for the generation. This may be different from the original prompt.", + "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "title": "prompt", + "type": "string" }, - "model": { - "$ref": "#/components/schemas/ModelEnum" + "resolution": { + "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", + "example": "4096x4096", + "pattern": "^\\d{2,5}x\\d{2,5}$", + "title": "FreeformResolution", + "type": "string" }, - "magic_prompt_option": { - "$ref": "#/components/schemas/MagicPromptOption" + "upscaled_resolution": { + "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", + "example": "4096x4096", + "pattern": "^\\d{2,5}x\\d{2,5}$", + "title": "FreeformResolution", + "type": "string" }, - "magic_prompt_version": { - "$ref": "#/components/schemas/MagicPromptVersionEnum" + "is_image_safe": { + "description": "Whether this request passes safety checks. If false, the url field will be empty.", + "title": "is_image_safe", + "type": "boolean" }, "seed": { "description": "Random seed. Set for reproducible generation.", @@ -4631,98 +6533,60 @@ "type": "integer" }, "style_type": { - "$ref": "#/components/schemas/StyleType" - }, - "negative_prompt": { - "description": "Only available for model versions V_1, V_1_TURBO, V_2 and V_2_TURBO. Description of what to exclude from an image. Descriptions in the prompt take precedence to descriptions in the negative prompt.", - "example": "brush strokes, painting", - "type": "string" - }, - "num_images": { - "default": 1, - "description": "The number of images to generate.", - "maximum": 8, - "minimum": 1, - "title": "NumImages", - "type": "integer" - }, - "resolution": { - "$ref": "#/components/schemas/Resolution" - }, - "color_palette": { - "$ref": "#/components/schemas/ColorPaletteWithPresetNameOrMembers" + "$ref": "#/components/schemas/StyleTypeV3" } }, "required": [ - "prompt" + "is_image_safe", + "prompt", + "resolution", + "seed" ], - "title": "ImageRequest", + "title": "V1EditImageObject", "type": "object" }, - "InitialImageRequest": { - "allOf": [ - { - "$ref": "#/components/schemas/ImageRequest" - } - ], - "description": "A request to generate a new image using a provided image and a prompt.", + "ImageObject": { "example": { - "aspect_ratio": "ASPECT_10_16", - "magic_prompt_option": "ON", - "model": "V_2", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "image_weight": 50 - }, - "properties": { - "image_weight": { - "default": 50, - "example": 50, - "maximum": 100, - "minimum": 1, - "type": "integer" - } + "style_type": "REALISTIC", + "seed": 12345, + "upscaled_resolution": "4096x4096", + "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "resolution": "1024x1024", + "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "is_image_safe": true }, - "title": "InitialImageRequest", - "type": "object" - }, - "UpscaleInitialImageRequest": { - "description": "A request to upscale a provided image with the help of an optional prompt.", "properties": { + "url": { + "description": "The direct link to the image generated.", + "example": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "format": "uri", + "nullable": true, + "title": "url", + "type": "string" + }, "prompt": { - "description": "An optional prompt to guide the upscale", - "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there is an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "description": "The prompt used for the generation. This may be different from the original prompt.", + "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", "title": "prompt", "type": "string" }, - "resemblance": { - "default": 50, - "example": 50, - "maximum": 100, - "minimum": 1, - "title": "resemblance", - "type": "integer" - }, - "detail": { - "default": 50, - "example": 50, - "maximum": 100, - "minimum": 1, - "title": "detail", - "type": "integer" - }, - "magic_prompt_option": { - "$ref": "#/components/schemas/MagicPromptOption" + "resolution": { + "description": "The resolution of the final image.", + "example": "1024x1024", + "title": "resolution", + "type": "string" }, - "magic_prompt_version": { - "$ref": "#/components/schemas/MagicPromptVersionEnum" + "upscaled_resolution": { + "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", + "example": "4096x4096", + "pattern": "^\\d{2,5}x\\d{2,5}$", + "title": "FreeformResolution", + "type": "string" }, - "num_images": { - "default": 1, - "description": "The number of images to generate.", - "maximum": 8, - "minimum": 1, - "title": "NumImages", - "type": "integer" + "is_image_safe": { + "description": "Whether this request passes safety checks. If false, the url field will be empty.", + "title": "is_image_safe", + "type": "boolean" }, "seed": { "description": "Random seed. Set for reproducible generation.", @@ -4731,37 +6595,51 @@ "minimum": 0, "title": "Seed", "type": "integer" + }, + "style_type": { + "$ref": "#/components/schemas/StyleType" } }, - "title": "UpscaleInitialImageRequest", + "required": [ + "is_image_safe", + "prompt", + "resolution", + "seed" + ], + "title": "ImageObject", "type": "object" }, - "GenerateImageResponse": { + "ImageGenerationResponseV4": { "description": "The response which contains information about the generated image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "example": { "data": [ { - "style_type": "REALISTIC", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "1024x1024", - "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "prompt": "prompt", + "resolution": "2048x2048", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true }, { - "style_type": "REALISTIC", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "1024x1024", - "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "prompt": "prompt", + "resolution": "2048x2048", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true } ], - "created": "2000-01-23T04:56:07+00:00" + "created": "2000-01-23T04:56:07+00:00", + "response_type": "url" }, "properties": { + "response_type": { + "description": "Discriminator for the postGenerateDesignV4 oneOf response. Always \"url\" for this shape.", + "enum": [ + "url" + ], + "title": "response_type", + "type": "string" + }, "created": { "description": "The time the request was created.", "format": "date-time", @@ -4771,7 +6649,7 @@ "data": { "description": "A list of ImageObjects that contain the generated image(s).", "items": { - "$ref": "#/components/schemas/ImageObject" + "$ref": "#/components/schemas/ImageGenerationObjectV4" }, "title": "data", "type": "array" @@ -4781,45 +6659,85 @@ "created", "data" ], - "title": "GenerateImageResponse", + "title": "ImageGenerationResponseV4", "type": "object" }, - "ImageGenerationResponseV3": { - "description": "The response which contains information about the generated image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "AsyncImageGenerationResponseV4": { + "description": "Acknowledgement returned by the async (webhook) generation endpoints. The\nrequest is accepted for asynchronous processing and the generated images\nare POSTed to the supplied `webhook_url` once ready; this body carries only\nthe generation_id so the caller can correlate the eventual webhook delivery.\n", + "example": { + "generation_id": "generation_id" + }, + "properties": { + "generation_id": { + "description": "URL-safe base64 ID of the accepted generation. Matches the\n`generation_id` field delivered in the webhook payload, and the\n`{generation_id}` accepted by the generation polling endpoint.\n", + "title": "generation_id", + "type": "string" + } + }, + "required": [ + "generation_id" + ], + "title": "AsyncImageGenerationResponseV4", + "type": "object" + }, + "GenerationResponse": { + "description": "The current status and, when complete, result data for an asynchronous generation.", "example": { "data": [ { - "style_type": "GENERAL", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "1280x800", + "prompt": "prompt", + "resolution": "2048x2048", "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true }, { - "style_type": "GENERAL", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "1280x800", + "prompt": "prompt", + "resolution": "2048x2048", "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true } ], - "created": "2000-01-23T04:56:07+00:00" + "generation_id": "generation_id", + "created": "2000-01-23T04:56:07+00:00", + "response_type": "url", + "status": "pending" }, "properties": { + "generation_id": { + "description": "URL-safe base64 ID of the generation.", + "title": "generation_id", + "type": "string" + }, + "status": { + "description": "Current status of the generation.", + "enum": [ + "pending", + "completed", + "failed" + ], + "title": "status", + "type": "string" + }, "created": { - "description": "The time the request was created.", + "description": "The time the generation was created.", "format": "date-time", "title": "created", "type": "string" }, + "response_type": { + "description": "Present when `status` is `completed`; always \"url\" for this shape.", + "enum": [ + "url" + ], + "title": "response_type", + "type": "string" + }, "data": { - "description": "A list of ImageObjects that contain the generated image(s).", + "description": "A list of generated images. Present when `status` is `completed`.", "items": { - "$ref": "#/components/schemas/ImageGenerationObjectV3" + "$ref": "#/components/schemas/ImageGenerationObject" }, "title": "data", "type": "array" @@ -4827,18 +6745,18 @@ }, "required": [ "created", - "data" + "generation_id", + "status" ], - "title": "ImageGenerationResponseV3", + "title": "GenerationResponse", "type": "object" }, - "ImageGenerationObjectV3": { + "ImageGenerationObject": { + "description": "A single generated image. Model-agnostic shape returned by the generation polling endpoint.", "example": { - "style_type": "GENERAL", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "1280x800", + "prompt": "prompt", + "resolution": "2048x2048", "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true }, @@ -4853,22 +6771,17 @@ }, "prompt": { "description": "The prompt used for the generation. This may be different from the original prompt.", - "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", "title": "prompt", "type": "string" }, "resolution": { - "$ref": "#/components/schemas/ResolutionV3" - }, - "upscaled_resolution": { - "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", - "example": "4096x4096", - "pattern": "^\\d{2,5}x\\d{2,5}$", - "title": "FreeformResolution", + "description": "The resolution of the generated image, formatted as \"{width}x{height}\".", + "example": "2048x2048", + "title": "resolution", "type": "string" }, "is_image_safe": { - "description": "Whether this request passes safety checks. If false, the url field will be empty.", + "description": "Whether this image passes safety checks. If false, the url field will be empty.", "title": "is_image_safe", "type": "boolean" }, @@ -4879,9 +6792,6 @@ "minimum": 0, "title": "Seed", "type": "integer" - }, - "style_type": { - "$ref": "#/components/schemas/StyleTypeV3" } }, "required": [ @@ -4890,64 +6800,14 @@ "resolution", "seed" ], - "title": "ImageGenerationObjectV3", - "type": "object" - }, - "V1EditImagesResponse": { - "description": "The response which contains information about the edited image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", - "example": { - "data": [ - { - "style_type": "GENERAL", - "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "4096x4096", - "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", - "is_image_safe": true - }, - { - "style_type": "GENERAL", - "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "4096x4096", - "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", - "is_image_safe": true - } - ], - "created": "2000-01-23T04:56:07+00:00" - }, - "properties": { - "created": { - "description": "The time the request was created.", - "format": "date-time", - "title": "created", - "type": "string" - }, - "data": { - "description": "A list of ImageObjects that contain the edited image(s).", - "items": { - "$ref": "#/components/schemas/V1EditImageObject" - }, - "title": "data", - "type": "array" - } - }, - "required": [ - "created", - "data" - ], - "title": "V1EditImagesResponse", + "title": "ImageGenerationObject", "type": "object" }, - "V1EditImageObject": { + "ImageGenerationObjectV4": { "example": { - "style_type": "GENERAL", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", - "resolution": "4096x4096", + "prompt": "prompt", + "resolution": "2048x2048", "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true }, @@ -4962,64 +6822,100 @@ }, "prompt": { "description": "The prompt used for the generation. This may be different from the original prompt.", - "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", "title": "prompt", "type": "string" }, "resolution": { - "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", - "example": "4096x4096", - "pattern": "^\\d{2,5}x\\d{2,5}$", - "title": "FreeformResolution", - "type": "string" - }, - "upscaled_resolution": { - "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", - "example": "4096x4096", - "pattern": "^\\d{2,5}x\\d{2,5}$", - "title": "FreeformResolution", - "type": "string" + "$ref": "#/components/schemas/ResolutionV4" }, "is_image_safe": { "description": "Whether this request passes safety checks. If false, the url field will be empty.", "title": "is_image_safe", "type": "boolean" }, - "seed": { - "description": "Random seed. Set for reproducible generation.", - "example": 12345, - "maximum": 2147483647, - "minimum": 0, - "title": "Seed", - "type": "integer" + "seed": { + "description": "Random seed. Set for reproducible generation.", + "example": 12345, + "maximum": 2147483647, + "minimum": 0, + "title": "Seed", + "type": "integer" + } + }, + "required": [ + "is_image_safe", + "prompt", + "resolution", + "seed" + ], + "title": "ImageGenerationObjectV4", + "type": "object" + }, + "ImageGenerationResponseV4ImageToImage": { + "description": "The response which contains information about the generated image-to-image output, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", + "example": { + "data": [ + { + "seed": 12345, + "prompt": "prompt", + "resolution": "1024x1024", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + }, + { + "seed": 12345, + "prompt": "prompt", + "resolution": "1024x1024", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", + "is_image_safe": true + } + ], + "created": "2000-01-23T04:56:07+00:00", + "response_type": "url" + }, + "properties": { + "response_type": { + "description": "Always \"url\" for this shape.", + "enum": [ + "url" + ], + "title": "response_type", + "type": "string" + }, + "created": { + "description": "The time the request was created.", + "format": "date-time", + "title": "created", + "type": "string" }, - "style_type": { - "$ref": "#/components/schemas/StyleTypeV3" + "data": { + "description": "A list of ImageObjects that contain the generated image(s).", + "items": { + "$ref": "#/components/schemas/ImageGenerationObjectV4ImageToImage" + }, + "title": "data", + "type": "array" } }, "required": [ - "is_image_safe", - "prompt", - "resolution", - "seed" + "created", + "data" ], - "title": "V1EditImageObject", + "title": "ImageGenerationResponseV4ImageToImage", "type": "object" }, - "ImageObject": { + "ImageGenerationObjectV4ImageToImage": { "example": { - "style_type": "REALISTIC", "seed": 12345, - "upscaled_resolution": "4096x4096", - "prompt": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", + "prompt": "prompt", "resolution": "1024x1024", - "url": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "is_image_safe": true }, "properties": { "url": { "description": "The direct link to the image generated.", - "example": "https://ideogram.ai/api/images/direct/8YEpFzHuS-S6xXEGmCsf7g", + "example": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", "format": "uri", "nullable": true, "title": "url", @@ -5027,22 +6923,11 @@ }, "prompt": { "description": "The prompt used for the generation. This may be different from the original prompt.", - "example": "A serene tropical beach scene. Dominating the foreground are tall palm trees with lush green leaves, standing tall against a backdrop of a sandy beach. The beach leads to the azure waters of the sea, which gently kisses the shoreline. In the distance, there's an island or landmass with a silhouette of what appears to be a lighthouse or tower. The sky above is painted with fluffy white clouds, some of which are tinged with hues of pink and orange, suggesting either a sunrise or sunset.", "title": "prompt", "type": "string" }, "resolution": { - "description": "The resolution of the final image.", - "example": "1024x1024", - "title": "resolution", - "type": "string" - }, - "upscaled_resolution": { - "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", - "example": "4096x4096", - "pattern": "^\\d{2,5}x\\d{2,5}$", - "title": "FreeformResolution", - "type": "string" + "$ref": "#/components/schemas/ResolutionV4ImageToImage" }, "is_image_safe": { "description": "Whether this request passes safety checks. If false, the url field will be empty.", @@ -5056,9 +6941,6 @@ "minimum": 0, "title": "Seed", "type": "integer" - }, - "style_type": { - "$ref": "#/components/schemas/StyleType" } }, "required": [ @@ -5067,31 +6949,20 @@ "resolution", "seed" ], - "title": "ImageObject", + "title": "ImageGenerationObjectV4ImageToImage", "type": "object" }, - "ImageGenerationResponseV4": { - "description": "The response which contains information about the generated image, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", - "example": { - "data": [ - { - "seed": 12345, - "prompt": "prompt", - "resolution": "1280x800", - "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", - "is_image_safe": true - }, - { - "seed": 12345, - "prompt": "prompt", - "resolution": "1280x800", - "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", - "is_image_safe": true - } - ], - "created": "2000-01-23T04:56:07+00:00" - }, + "ImageGenerationResponseV4Layout": { + "description": "The response which contains information about the generated layout-to-image output, including the download link.\nImages links are available for a limited period of time; if you would like to keep the image, you must download it.", "properties": { + "response_type": { + "description": "Discriminator for the postGenerateDesignV4 oneOf response. Always \"url\" for this shape.", + "enum": [ + "url" + ], + "title": "response_type", + "type": "string" + }, "created": { "description": "The time the request was created.", "format": "date-time", @@ -5101,7 +6972,7 @@ "data": { "description": "A list of ImageObjects that contain the generated image(s).", "items": { - "$ref": "#/components/schemas/ImageGenerationObjectV4" + "$ref": "#/components/schemas/ImageGenerationObjectV4Layout" }, "title": "data", "type": "array" @@ -5111,17 +6982,10 @@ "created", "data" ], - "title": "ImageGenerationResponseV4", + "title": "ImageGenerationResponseV4Layout", "type": "object" }, - "ImageGenerationObjectV4": { - "example": { - "seed": 12345, - "prompt": "prompt", - "resolution": "1280x800", - "url": "https://ideogram.ai/api/images/ephemeral/xtdZiqPwRxqY1Y7NExFmzB.png?exp=1743867804&sig=e13e12677633f646d8531a153d20e2d3698dca9ee7661ee5ba4f3b64e7ec3f89", - "is_image_safe": true - }, + "ImageGenerationObjectV4Layout": { "properties": { "url": { "description": "The direct link to the image generated.", @@ -5137,7 +7001,7 @@ "type": "string" }, "resolution": { - "$ref": "#/components/schemas/ResolutionV4" + "$ref": "#/components/schemas/ResolutionV4Layout" }, "is_image_safe": { "description": "Whether this request passes safety checks. If false, the url field will be empty.", @@ -5159,7 +7023,7 @@ "resolution", "seed" ], - "title": "ImageGenerationObjectV4", + "title": "ImageGenerationObjectV4Layout", "type": "object" }, "LayeredImageGenerationObjectV3": { @@ -5196,7 +7060,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5206,6 +7086,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5231,7 +7112,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5241,6 +7138,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5271,7 +7169,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5281,6 +7195,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5306,7 +7221,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5316,6 +7247,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5324,17 +7256,17 @@ "image_layers": [ { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 }, { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 } ], "url": "https://openapi-generator.tech", @@ -5406,7 +7338,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5416,6 +7364,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5441,7 +7390,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5451,6 +7416,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5481,7 +7447,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5491,6 +7473,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5516,7 +7499,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5526,6 +7525,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5534,17 +7534,17 @@ "image_layers": [ { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 }, { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 } ], "url": "https://openapi-generator.tech", @@ -5578,7 +7578,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5588,6 +7604,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5613,7 +7630,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5623,6 +7656,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5653,7 +7687,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5663,6 +7713,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -5688,7 +7739,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -5698,6 +7765,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -5706,26 +7774,35 @@ "image_layers": [ { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 }, { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 } ], "url": "https://openapi-generator.tech", "text_html": "text_html" } ], - "created": "2000-01-23T04:56:07+00:00" + "created": "2000-01-23T04:56:07+00:00", + "response_type": "layered" }, "properties": { + "response_type": { + "description": "Discriminator for the postGenerateDesignV4 oneOf response. Always \"layered\" for this shape; absent on the legacy postGenerateDesignV3 endpoint.", + "enum": [ + "layered" + ], + "title": "response_type", + "type": "string" + }, "created": { "description": "The time the request was created.", "format": "date-time", @@ -5748,23 +7825,6 @@ "title": "LayeredImageGenerationResponseV3", "type": "object" }, - "MagicPromptVersionEnum": { - "description": "The magic prompt version to use when magic prompt option is set to AUTO or ON.", - "enum": [ - "V_0", - "V_0_1", - "V_0_2", - "V_0_3", - "V_0_4", - "V_0_5", - "V_0_6", - "V_0_7", - "V_0_8" - ], - "example": "V_0", - "title": "MagicPromptVersionEnum", - "type": "string" - }, "ModelEnum": { "default": "V_2", "description": "The model used to generate an image or edit one. /generate and /remix supports all model types, however, /edit is only supported for V_2 and V_2_TURBO.", @@ -5810,7 +7870,7 @@ }, "properties": { "prompt": { - "description": "The prompt to enhance with a magic prompt", + "description": "The prompt to enhance with a magic prompt. Mutually\nexclusive with `messages`; one of the two must be set.\n", "example": "a cat", "type": "string" }, @@ -5843,31 +7903,179 @@ "description": "A system prompt to use for the magic prompt.", "example": "You are a helpful assistant that generates magic prompts for images.", "type": "string" + }, + "aspect_ratio": { + "allOf": [ + { + "$ref": "#/components/schemas/AspectRatioV3" + } + ], + "description": "Optional target aspect ratio used to condition the generated\nmagic prompt's framing. Forwarded to the autoprompt pipeline\nso registry-driven system prompts that interpolate\n`` see the bucket the caller intends.\n" + }, + "temperature": { + "description": "Sampling temperature override. Defaults to the trainer-conditioned\nvalue when omitted (0.7 for V4_QWEN_3_5_27B). Only honored with\nV4 magic-prompt versions; supplying it with another version\nreturns 400.\n", + "format": "float", + "maximum": 2, + "minimum": 0, + "type": "number" + }, + "top_p": { + "description": "Nucleus-sampling top_p override. Only honored with V4 versions.\n", + "exclusiveMinimum": true, + "format": "float", + "maximum": 1, + "minimum": 0, + "type": "number" + }, + "top_k": { + "description": "Top-k sampling override. Only honored with V4 versions.\n", + "minimum": 0, + "type": "integer" + }, + "min_p": { + "description": "min_p sampling override. Only honored with V4 versions.\n", + "format": "float", + "maximum": 1, + "minimum": 0, + "type": "number" + }, + "max_tokens": { + "description": "Cap on the number of tokens the model may generate. Defaults to\n4096 (the trainer's reference cap) when omitted. Only honored\nwith V4 versions.\n", + "maximum": 4096, + "minimum": 1, + "type": "integer" + }, + "presence_penalty": { + "description": "Presence-penalty override. Only honored with V4 versions.\n", + "format": "float", + "maximum": 2, + "minimum": -2, + "type": "number" + }, + "frequency_penalty": { + "description": "Frequency-penalty override. Only honored with V4 versions.\n", + "format": "float", + "maximum": 2, + "minimum": -2, + "type": "number" + }, + "repetition_penalty": { + "description": "Repetition-penalty override. Only honored with V4 versions.\n", + "format": "float", + "maximum": 2, + "minimum": 0, + "type": "number" + }, + "checkpoint": { + "description": "Optional override of the LoRA adapter the V4 magic-prompt\nwrapper downloads and runs. Pass a `gs://` URI pointing at a\ncheckpoint directory containing `adapter_config.json`. When\nomitted, the wrapper-preloaded production checkpoint is used.\nHonored with the wrapper-routed LoRA versions\n`V4_QWEN_3_5_27B` and `V4_QWEN_3_5_27B_FULL_FINETUNE_LORA`;\nsupplying it with `V4_QWEN_3_5_27B_PREFUSED` or\n`V4_QWEN_3_5_27B_FULL_FINETUNE` (which serve fixed weights and\ncannot swap adapters per request) or any other version returns\n400.\n", + "pattern": "^gs://", + "type": "string" + }, + "messages": { + "description": "Pre-formed chat messages forwarded verbatim to V4. Mutually\nexclusive with `prompt`; exactly one must be set. V4 only.\n", + "items": { + "$ref": "#/components/schemas/MagicPromptRequest_messages_inner" + }, + "minItems": 1, + "type": "array" } }, "required": [ "classify_prompt_category", - "magic_prompt_version", - "prompt" + "magic_prompt_version" ], "title": "MagicPromptRequest", "type": "object" }, - "MagicPromptResponse": { - "description": "The response containing generated magic prompt", + "MagicPromptResponse": { + "description": "The response containing generated magic prompt", + "example": { + "magic_prompt": "A photorealistic cat with striking green eyes, sitting gracefully on a vintage wooden chair. The cat's fur has beautiful orange and white markings, and soft natural lighting illuminates the scene from a nearby window." + }, + "properties": { + "magic_prompt": { + "description": "The generated magic prompt", + "type": "string" + } + }, + "required": [ + "magic_prompt" + ], + "title": "MagicPromptResponse", + "type": "object" + }, + "MagicPromptV4Request": { + "description": "A request to generate an Ideogram 4.0 magic prompt.", + "example": { + "text_prompt": "a cat", + "aspect_ratio": "AUTO" + }, + "properties": { + "text_prompt": { + "description": "The natural-language prompt to enhance into an Ideogram 4.0 magic\nprompt. Named `text_prompt` to match the Ideogram 4.0 generate\nrequest surface.\n", + "example": "a cat", + "type": "string" + }, + "aspect_ratio": { + "allOf": [ + { + "$ref": "#/components/schemas/AspectRatioV4" + } + ], + "description": "Target aspect ratio. Defaults to `AUTO`, which lets the model\nselect the most suitable ratio and return it in the response.\n" + } + }, + "required": [ + "text_prompt" + ], + "title": "MagicPromptV4Request", + "type": "object" + }, + "MagicPromptV4Response": { + "description": "The response containing the generated Ideogram 4.0 magic prompt.", "example": { - "magic_prompt": "A photorealistic cat with striking green eyes, sitting gracefully on a vintage wooden chair. The cat's fur has beautiful orange and white markings, and soft natural lighting illuminates the scene from a nearby window." + "json_prompt": { + "high_level_description": "A photorealistic ginger cat perched on a vintage wooden chair by a sunlit window.", + "style_description": { + "aesthetics": "warm, cozy, nostalgic", + "lighting": "soft natural window light", + "medium": "photograph" + }, + "compositional_deconstruction": { + "background": "A dim room with a bright window casting warm light.", + "elements": [ + { + "type": "obj", + "desc": "ginger cat with green eyes sitting upright on a vintage wooden chair" + } + ] + } + }, + "aspect_ratio": "1x1" }, "properties": { - "magic_prompt": { - "description": "The generated magic prompt", - "type": "string" + "json_prompt": { + "allOf": [ + { + "$ref": "#/components/schemas/V4JsonPrompt" + } + ], + "description": "The enhanced prompt as an Ideogram 4.0 structured JSON prompt. This\nconforms to the same contract as `json_prompt` on\n`/v1/ideogram-v4/generate`, so it can be passed straight back to\nthat endpoint.\n" + }, + "aspect_ratio": { + "allOf": [ + { + "$ref": "#/components/schemas/AspectRatioV4" + } + ], + "description": "The resolved aspect ratio. When the request used `AUTO`, this is\nthe ratio the model selected; otherwise it echoes the request.\n" } }, "required": [ - "magic_prompt" + "aspect_ratio", + "json_prompt" ], - "title": "MagicPromptResponse", + "title": "MagicPromptV4Response", "type": "object" }, "InternalBatchRequest": { @@ -5878,6 +8086,7 @@ "a dog" ], "sampling_request_params": { + "magic_prompt_system_prompt_config_id": "magic_prompt_system_prompt_config_id", "aspect_ratio": "1x1", "style_type": "GENERAL", "magic_prompt_version": "V_0", @@ -5942,6 +8151,7 @@ }, "SamplingRequestParams": { "example": { + "magic_prompt_system_prompt_config_id": "magic_prompt_system_prompt_config_id", "aspect_ratio": "1x1", "style_type": "GENERAL", "magic_prompt_version": "V_0", @@ -5971,6 +8181,11 @@ "magic_prompt_option": { "$ref": "#/components/schemas/MagicPromptOption" }, + "magic_prompt_system_prompt_config_id": { + "description": "A base64url-encoded magic prompt system prompt config ID to use for this request.", + "title": "magic_prompt_system_prompt_config_id", + "type": "string" + }, "magic_prompt_version": { "$ref": "#/components/schemas/MagicPromptVersionEnum" }, @@ -6088,7 +8303,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -6098,6 +8329,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, "properties": { @@ -6192,6 +8424,44 @@ "title": "line_height", "type": "number" }, + "letter_spacing": { + "description": "Letter spacing in em units (e.g. 0.05 = 5% of em). V4 vector-text only.", + "format": "float", + "nullable": true, + "title": "letter_spacing", + "type": "number" + }, + "text_transform": { + "description": "Case folding applied at render time. V4 vector-text only.", + "enum": [ + "none", + "uppercase", + "lowercase" + ], + "nullable": true, + "title": "text_transform", + "type": "string" + }, + "vertical_alignment": { + "description": "Vertical anchor (top|middle|bottom) for the rendered text within\nits bounding box. Maps to SVG `dominant-baseline`. V4 vector-text\nonly. Distinct from horizontal `alignment` (left|center|right).\n", + "enum": [ + "top", + "middle", + "bottom" + ], + "nullable": true, + "title": "vertical_alignment", + "type": "string" + }, + "text_shadows": { + "description": "Stacked CSS text shadows, composed back-to-front. Phase-1 ships at\nmost one entry; phase-2 unlocks multi-stack. V4 vector-text only.\n", + "items": { + "$ref": "#/components/schemas/LayeredAssetTextShadow" + }, + "nullable": true, + "title": "text_shadows", + "type": "array" + }, "spans": { "description": "Ordered list of text spans. Concatenating span text values produces the full item text.", "items": { @@ -6241,7 +8511,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -6251,6 +8537,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 }, { @@ -6276,7 +8563,23 @@ ] } ], + "text_shadows": [ + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + } + ], "font_size": 5, + "vertical_alignment": "top", + "text_transform": "none", "glyph_type": "bullet", "line_height": 2.302136, "x": 0, @@ -6286,6 +8589,7 @@ "angle": 0, "alignment": "center", "font_file": "font_file", + "letter_spacing": 7.0614014, "height": 5 } ] @@ -6316,10 +8620,10 @@ "description": "An image layer (logo, brand asset, icon) for a layered image generation.", "example": { "ref_id": "REF_0", - "x": 7, - "width": 3, - "y": 9, - "height": 2 + "x": 4, + "width": 1, + "y": 7, + "height": 1 }, "properties": { "x": { @@ -6654,6 +8958,13 @@ "title": "InternalBatchResultsResponse", "type": "object" }, + "WebhookUrl": { + "description": "HTTPS URL that Ideogram delivers the generated result to. Ideogram sends a\nJSON POST to this URL once all images for the request have finished\ngenerating. The body mirrors the synchronous generate response:\n`request_id`, `created`, and a `data` array\ncontaining every generated image (`url`, `prompt`, `resolution`, `seed`,\n`is_image_safe`). Each delivery is signed with Ed25519 and verifiable\nagainst the public keys at `/v1/.well-known/jwks.json`. Must be HTTPS;\nprivate and loopback hosts and the cloud metadata service are rejected.\n", + "example": "https://api.example.com/webhooks/ideogram", + "format": "uri", + "maxLength": 2048, + "type": "string" + }, "ImageSafetyError": { "example": { "error": "Image provided failed safety check due to the inclusion of prohibited content." @@ -6671,6 +8982,103 @@ "title": "ImageSafetyError", "type": "object" }, + "WebhookSigningJwks": { + "description": "JSON Web Key Set listing the Ed25519 public keys Ideogram uses to sign\nwebhook payloads. Each entry follows RFC 7517 conventions for OKP keys.\n", + "example": { + "keys": [ + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "kid": "v1", + "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo", + "alg": "EdDSA" + }, + { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "kid": "v1", + "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo", + "alg": "EdDSA" + } + ] + }, + "properties": { + "keys": { + "description": "Active and recently-rotated signing keys. A webhook is authentic if\nits signature verifies against any key in this list.\n", + "items": { + "$ref": "#/components/schemas/WebhookSigningJwk" + }, + "title": "keys", + "type": "array" + } + }, + "required": [ + "keys" + ], + "title": "WebhookSigningJwks", + "type": "object" + }, + "WebhookSigningJwk": { + "description": "A single Ed25519 public key. The `x` field carries the 32-byte public\nkey as base64url without padding; `kid` matches the\n`X-Ideogram-Webhook-Key-Id` header on outbound webhooks for cache hints,\nbut verifiers SHOULD try every key in the set rather than relying on\n`kid` alone.\n", + "example": { + "kty": "OKP", + "crv": "Ed25519", + "use": "sig", + "kid": "v1", + "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo", + "alg": "EdDSA" + }, + "properties": { + "kty": { + "description": "Key type. Always `\"OKP\"` for Ed25519.", + "example": "OKP", + "title": "kty", + "type": "string" + }, + "crv": { + "description": "Curve. Always `\"Ed25519\"`.", + "example": "Ed25519", + "title": "crv", + "type": "string" + }, + "x": { + "description": "The 32-byte public key, base64url-encoded without padding.", + "example": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo", + "title": "x", + "type": "string" + }, + "kid": { + "description": "Opaque key identifier; stable across rotations of the same key.", + "example": "v1", + "title": "kid", + "type": "string" + }, + "alg": { + "description": "Always `\"EdDSA\"`.", + "example": "EdDSA", + "title": "alg", + "type": "string" + }, + "use": { + "description": "Always `\"sig\"` (signing-only).", + "example": "sig", + "title": "use", + "type": "string" + } + }, + "required": [ + "alg", + "crv", + "kid", + "kty", + "use", + "x" + ], + "title": "WebhookSigningJwk", + "type": "object" + }, "ManageApiSubscriptionResponse": { "example": { "recharge_settings": { @@ -6897,6 +9305,148 @@ "title": "PostApiSubscriptionRequest", "type": "object" }, + "ManageApiCreditSummaryResponse": { + "example": { + "total_issued": { + "amount": 1050, + "currency_code": "USD" + }, + "total_expired": { + "amount": 1050, + "currency_code": "USD" + }, + "total_consumed": { + "amount": 1050, + "currency_code": "USD" + }, + "credit_grants": [ + { + "effective_at": "effective_at", + "amount_consumed": { + "amount": 1050, + "currency_code": "USD" + }, + "expires_at": "expires_at", + "amount_available": { + "amount": 1050, + "currency_code": "USD" + }, + "grant_id": "grant_id", + "name": "name", + "amount_issued": { + "amount": 1050, + "currency_code": "USD" + } + }, + { + "effective_at": "effective_at", + "amount_consumed": { + "amount": 1050, + "currency_code": "USD" + }, + "expires_at": "expires_at", + "amount_available": { + "amount": 1050, + "currency_code": "USD" + }, + "grant_id": "grant_id", + "name": "name", + "amount_issued": { + "amount": 1050, + "currency_code": "USD" + } + } + ] + }, + "properties": { + "total_consumed": { + "$ref": "#/components/schemas/Price" + }, + "total_expired": { + "$ref": "#/components/schemas/Price" + }, + "total_issued": { + "$ref": "#/components/schemas/Price" + }, + "credit_grants": { + "description": "Per-grant breakdown of the user's credit grants. Empty if Metronome is unavailable.", + "items": { + "$ref": "#/components/schemas/CreditGrant" + }, + "title": "credit_grants", + "type": "array" + } + }, + "required": [ + "credit_grants", + "total_consumed", + "total_expired", + "total_issued" + ], + "title": "ManageApiCreditSummaryResponse", + "type": "object" + }, + "CreditGrant": { + "example": { + "effective_at": "effective_at", + "amount_consumed": { + "amount": 1050, + "currency_code": "USD" + }, + "expires_at": "expires_at", + "amount_available": { + "amount": 1050, + "currency_code": "USD" + }, + "grant_id": "grant_id", + "name": "name", + "amount_issued": { + "amount": 1050, + "currency_code": "USD" + } + }, + "properties": { + "grant_id": { + "description": "The Metronome grant identifier.", + "title": "grant_id", + "type": "string" + }, + "name": { + "description": "The grant name as shown in Metronome (e.g. \"Ideogram API Usage\").", + "title": "name", + "type": "string" + }, + "amount_issued": { + "$ref": "#/components/schemas/Price" + }, + "amount_consumed": { + "$ref": "#/components/schemas/Price" + }, + "amount_available": { + "$ref": "#/components/schemas/Price" + }, + "effective_at": { + "description": "ISO-8601 timestamp when the grant becomes effective.", + "title": "effective_at", + "type": "string" + }, + "expires_at": { + "description": "ISO-8601 timestamp when the grant expires. Omitted if the grant has no expiration.", + "title": "expires_at", + "type": "string" + } + }, + "required": [ + "amount_available", + "amount_consumed", + "amount_issued", + "effective_at", + "grant_id", + "name" + ], + "title": "CreditGrant", + "type": "object" + }, "PostApiReactivateResponse": { "description": "Response to re-activating API settings.", "example": { @@ -6951,68 +9501,163 @@ "properties": { "redacted_api_key": { "description": "A redacted text snippet of the API key. Contains the first 4 characters of the API key", - "example": "vkpDja", + "example": "vkpDja", + "title": "redacted_api_key", + "type": "string" + }, + "creation_time": { + "description": "The time at which the key was created", + "format": "date-time", + "title": "creation_time", + "type": "string" + }, + "api_key_id": { + "description": "A URL safe base64 encoded UUID", + "example": "JRPVD7jWR1aTBYiJ0UFVOg==", + "title": "api_key_id", + "type": "string" + } + }, + "required": [ + "api_key_id", + "creation_time", + "redacted_api_key" + ], + "title": "RedactedApiKey", + "type": "object" + }, + "PostApiKeyResponse": { + "example": { + "api_key": "example_api_key_replace_with_your_actual_key", + "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg==" + }, + "properties": { + "api_key": { + "description": "The API key to use when making authenticated requests with the API. This key will only be shown once.", + "example": "example_api_key_replace_with_your_actual_key", + "title": "api_key", + "type": "string" + }, + "api_key_id": { + "description": "The ID of the API key. A URL safe base64 encoded UUID", + "example": "JRPVD7jWR1aTBYiJ0UFVOg==", + "title": "api_key_id", + "type": "string" + } + }, + "required": [ + "api_key", + "api_key_id" + ], + "title": "PostApiKeyResponse", + "type": "object" + }, + "CreateApiKeyRequest": { + "example": { + "label": "label" + }, + "nullable": true, + "properties": { + "label": { + "description": "User-supplied label shown alongside the key in the management UI.", + "maxLength": 64, + "title": "label", + "type": "string" + } + }, + "title": "CreateApiKeyRequest", + "type": "object" + }, + "ApiProfileApiKey": { + "example": { + "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", + "redacted_api_key": "ATG56•••••••••••••", + "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", + "status": null + }, + "properties": { + "api_key_id": { + "description": "Base64 encoded API key ID", + "example": "JRPVD7jWR1aTBYiJ0UFVOg", + "title": "api_key_id", + "type": "string" + }, + "redacted_api_key": { + "description": "A redacted text snippet of the API key. Contains the first 4 characters of the API key", + "example": "ATG56•••••••••••••", "title": "redacted_api_key", "type": "string" }, "creation_time": { - "description": "The time at which the key was created", + "description": "The date at which the API key was created", "format": "date-time", "title": "creation_time", "type": "string" }, - "api_key_id": { - "description": "A URL safe base64 encoded UUID", - "example": "JRPVD7jWR1aTBYiJ0UFVOg==", - "title": "api_key_id", + "status": { + "$ref": "#/components/schemas/ApiKeyStatus" + }, + "label": { + "description": "An optional user-supplied label for managing the API key", + "example": "Live production environment", + "nullable": true, + "title": "label", "type": "string" } }, "required": [ "api_key_id", "creation_time", - "redacted_api_key" + "redacted_api_key", + "status" ], - "title": "RedactedApiKey", + "title": "ApiProfileApiKey", "type": "object" }, - "PostApiKeyResponse": { + "ApiKeyStatus": { + "description": "Status of the API key", + "enum": [ + "ACTIVE", + "DISABLED" + ], + "title": "ApiKeyStatus", + "type": "string" + }, + "PatchApiKeyRequest": { "example": { - "api_key": "example_api_key_replace_with_your_actual_key", - "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg==" + "label": "Live production environment" }, "properties": { - "api_key": { - "description": "The API key to use when making authenticated requests with the API. This key will only be shown once.", - "example": "example_api_key_replace_with_your_actual_key", - "title": "api_key", - "type": "string" - }, - "api_key_id": { - "description": "The ID of the API key. A URL safe base64 encoded UUID", - "example": "JRPVD7jWR1aTBYiJ0UFVOg==", - "title": "api_key_id", + "label": { + "description": "New label for the API key. Pass null (or omit) to clear the existing label.", + "example": "Live production environment", + "maxLength": 64, + "nullable": true, + "title": "label", "type": "string" } }, - "required": [ - "api_key", - "api_key_id" - ], - "title": "PostApiKeyResponse", + "title": "PatchApiKeyRequest", "type": "object" }, "ManageApiStripeSubscriptionResponse": { "example": { "stripe_subscription_url": "stripe_subscription_url", - "stripe_billing_url": "stripe_billing_url" + "stripe_billing_url": "stripe_billing_url", + "stripe_payment_setup_url": "stripe_payment_setup_url" }, "properties": { "stripe_subscription_url": { - "description": "The URL for the user to checkout the Stripe subscription plan.", + "description": "The URL for the user to checkout the Stripe subscription plan. Soft-deprecated — this is the legacy $0-subscription flow; new clients use stripe_payment_setup_url instead. Removed once no callers reference it.", "title": "stripe_subscription_url", "type": "string" }, + "stripe_payment_setup_url": { + "description": "The URL for the user to capture a payment method via hosted Stripe Checkout (mode='setup'). No charge happens during this flow; the captured payment method is attached to the org's Stripe Customer via the checkout.session.completed webhook.", + "title": "stripe_payment_setup_url", + "type": "string" + }, "stripe_billing_url": { "deprecated": true, "description": "DEPRECATED. The URL for the user to manage the existing Stripe subscription plan. Get this from ManageApiSubscriptionResponse instead.", @@ -7023,6 +9668,23 @@ "title": "ManageApiStripeSubscriptionResponse", "type": "object" }, + "ManageApiPaymentResponse": { + "example": { + "client_secret": "client_secret" + }, + "properties": { + "client_secret": { + "description": "client_secret to be passed to the inline payment Elements on the client. Soft-deprecated — new clients use stripe_payment_setup_url on ManageApiStripeSubscriptionResponse for the hosted Checkout flow.", + "title": "client_secret", + "type": "string" + } + }, + "required": [ + "client_secret" + ], + "title": "ManageApiPaymentResponse", + "type": "object" + }, "GetApiTermsResponse": { "example": { "api_terms": { @@ -7492,7 +10154,7 @@ "type": "string" }, "ModelVersion": { - "description": "The model_version to use.\n- V_0_3: Model 1.0\n- V_1_1: Model 1.1\n- V_1_5: Model 2.0\n- V_2_1: Model 2a\n- V_3_0: Model 3.0 March 26\n- V_3_1: Model 3.0 Latest\n- V_4_0: Model 4.0\n- AUTO: Automatically select the best model version based on the request.\n", + "description": "The model_version to use.\n- V_0_3: Model 1.0\n- V_1_1: Model 1.1\n- V_1_5: Model 2.0\n- V_2_1: Model 2a\n- V_3_0: Model 3.0 March 26\n- V_3_1: Model 3.0 Latest\n- V_4_0: Model 4.0\n- V_4_D: Model 4.0 Layered Design (vector-text path; gated by the access_to_v4 feature flag)\n- V_4_LAYOUT2IMAGE: Model 4.0 Layout to Image (HTML layout rasterized as IMAGE_TO_IMAGE conditioning; gated by the access_to_v4 feature flag)\n- AUTO: Automatically select the best model version based on the request.\n", "enum": [ "V_0_1", "V_0_2", @@ -7503,6 +10165,8 @@ "V_3_0", "V_3_1", "V_4_0", + "V_4_D", + "V_4_LAYOUT2IMAGE", "EXTERNAL_GOOGLE_VEO_3_0", "EXTERNAL_BYTEDANCE_SEEDANCE_1_0_PRO", "EXTERNAL_MINIMAX_HAILUO_02", @@ -7518,6 +10182,7 @@ "profiles": [ { "is_metronome_2_user": true, + "copyright_detection_enabled": true, "role": "OWNER", "avatar_url": "https://example.com/avatar.jpg", "organization_id": "b3JnYW5pemF0aW9uXzEyMw", @@ -7526,12 +10191,14 @@ "api_keys": [ { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null }, { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null @@ -7541,6 +10208,7 @@ }, { "is_metronome_2_user": true, + "copyright_detection_enabled": true, "role": "OWNER", "avatar_url": "https://example.com/avatar.jpg", "organization_id": "b3JnYW5pemF0aW9uXzEyMw", @@ -7549,12 +10217,14 @@ "api_keys": [ { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null }, { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null @@ -7584,6 +10254,7 @@ "ApiProfile": { "example": { "is_metronome_2_user": true, + "copyright_detection_enabled": true, "role": "OWNER", "avatar_url": "https://example.com/avatar.jpg", "organization_id": "b3JnYW5pemF0aW9uXzEyMw", @@ -7592,12 +10263,14 @@ "api_keys": [ { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null }, { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null @@ -7649,6 +10322,12 @@ "example": 10, "title": "max_num_inflight_requests_permitted", "type": "integer" + }, + "copyright_detection_enabled": { + "description": "Whether post-generation copyright detection (Hive likeness + logo) is enabled for this organization's API generations. When true, every successful generation is run through Hive IP scoring after the asset is saved; images that cross the likeness or logo thresholds come back with `is_image_safe = false`. Only populated for ENTERPRISE profiles.", + "nullable": true, + "title": "copyright_detection_enabled", + "type": "boolean" } }, "required": [ @@ -7667,7 +10346,8 @@ "description": "Type of API profile", "enum": [ "INDIVIDUAL", - "ENTERPRISE" + "ENTERPRISE", + "TEAM_API" ], "example": "INDIVIDUAL", "title": "ApiProfileType", @@ -7683,53 +10363,38 @@ "title": "ApiProfileRole", "type": "string" }, - "ApiProfileApiKey": { + "UpdateOrganizationApiPropertiesResponse": { "example": { - "creation_time": "2000-01-23T04:56:07+00:00", - "redacted_api_key": "ATG56•••••••••••••", - "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", - "status": null + "copyright_detection_enabled": true }, "properties": { - "api_key_id": { - "description": "Base64 encoded API key ID", - "example": "JRPVD7jWR1aTBYiJ0UFVOg", - "title": "api_key_id", - "type": "string" - }, - "redacted_api_key": { - "description": "A redacted text snippet of the API key. Contains the first 4 characters of the API key", - "example": "ATG56•••••••••••••", - "title": "redacted_api_key", - "type": "string" - }, - "creation_time": { - "description": "The date at which the API key was created", - "format": "date-time", - "title": "creation_time", - "type": "string" - }, - "status": { - "$ref": "#/components/schemas/ApiKeyStatus" + "copyright_detection_enabled": { + "description": "The setting after the update.", + "title": "copyright_detection_enabled", + "type": "boolean" } }, "required": [ - "api_key_id", - "creation_time", - "redacted_api_key", - "status" + "copyright_detection_enabled" ], - "title": "ApiProfileApiKey", + "title": "UpdateOrganizationApiPropertiesResponse", "type": "object" }, - "ApiKeyStatus": { - "description": "Status of the API key", - "enum": [ - "ACTIVE", - "DISABLED" - ], - "title": "ApiKeyStatus", - "type": "string" + "UpdateOrganizationApiPropertiesRequest": { + "description": "Partial update for an organization's API-only properties. Only fields explicitly present are written; unset fields preserve their current value.", + "example": { + "copyright_detection_enabled": true + }, + "properties": { + "copyright_detection_enabled": { + "description": "Toggle post-generation Hive likeness + logo detection for this organization. See ApiProfile.copyright_detection_enabled for behavior.", + "nullable": true, + "title": "copyright_detection_enabled", + "type": "boolean" + } + }, + "title": "UpdateOrganizationApiPropertiesRequest", + "type": "object" }, "GetApiOrganizationUserSuggestionsResponse": { "example": { @@ -7939,12 +10604,14 @@ "api_keys": [ { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null }, { "creation_time": "2000-01-23T04:56:07+00:00", + "label": "Live production environment", "redacted_api_key": "ATG56•••••••••••••", "api_key_id": "JRPVD7jWR1aTBYiJ0UFVOg", "status": null @@ -8414,6 +11081,29 @@ "title": "InvoiceLineItem", "type": "object" }, + "GetOrganizationBillingPortalResponse": { + "example": { + "has_stripe_setup": true, + "stripe_billing_url": "stripe_billing_url" + }, + "properties": { + "has_stripe_setup": { + "description": "Whether or not Stripe billing is set up for the organization's API usage.", + "title": "has_stripe_setup", + "type": "boolean" + }, + "stripe_billing_url": { + "description": "The URL for an organization admin to manage the organization's Stripe billing, including adding or removing payment methods. Absent when no Stripe customer exists for the organization.", + "title": "stripe_billing_url", + "type": "string" + } + }, + "required": [ + "has_stripe_setup" + ], + "title": "GetOrganizationBillingPortalResponse", + "type": "object" + }, "ListDatasetsResponse": { "example": { "datasets": [ @@ -9237,20 +11927,369 @@ "title": "ema", "type": "number" }, - "learning_rate": { - "description": "Learning rate for the optimizer. Must be greater than 0. Typical values for LoRA fine-tuning are 1e-5 to 1e-4; larger values train faster but risk instability.\n", - "example": 0.0001, - "title": "learning_rate", - "type": "number" + "learning_rate": { + "description": "Learning rate for the optimizer. Must be greater than 0. Typical values for LoRA fine-tuning are 1e-5 to 1e-4; larger values train faster but risk instability.\n", + "example": 0.0001, + "title": "learning_rate", + "type": "number" + } + }, + "required": [ + "dataset_id", + "model_name" + ], + "title": "TrainModelV3AdvancedRequest", + "type": "object" + }, + "V4JsonPrompt": { + "description": "Structured prompt for Ideogram 4.0 generation. When `json_prompt` is\nsupplied, magic-prompt is disabled and the diffusion model consumes\nthe JSON contract directly. Mutually exclusive with `text_prompt`\nand the legacy `prompt` field.\n", + "example": { + "high_level_description": "high_level_description", + "style_description": { + "photo": "photo", + "art_style": "art_style", + "medium": "medium", + "aesthetics": "aesthetics", + "lighting": "lighting" + }, + "compositional_deconstruction": { + "background": "background", + "elements": [ + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + }, + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + } + ] + }, + "tags": [ + "tags", + "tags" + ] + }, + "properties": { + "high_level_description": { + "description": "One- or two-sentence overall description of the desired image.", + "title": "high_level_description", + "type": "string" + }, + "style_description": { + "$ref": "#/components/schemas/V4StyleDescription" + }, + "compositional_deconstruction": { + "$ref": "#/components/schemas/V4CompositionalDeconstruction" + }, + "tags": { + "description": "Round-trip metadata surfaced by the describe endpoint when\n`strip_tags=false`. Ignored by the v4 sampler on generate input.\n", + "items": { + "type": "string" + }, + "title": "tags", + "type": "array" + } + }, + "required": [ + "compositional_deconstruction", + "high_level_description" + ], + "title": "V4JsonPrompt", + "type": "object", + "x-drop-nulls": true + }, + "V4StyleDescription": { + "description": "Optional style description supplied alongside a V4 JSON prompt.", + "example": { + "photo": "photo", + "art_style": "art_style", + "medium": "medium", + "aesthetics": "aesthetics", + "lighting": "lighting" + }, + "properties": { + "aesthetics": { + "description": "Aesthetic notes (mood, vibe, references).", + "title": "aesthetics", + "type": "string" + }, + "art_style": { + "description": "Optional art-style hint (e.g., illustration, oil painting).", + "title": "art_style", + "type": "string" + }, + "lighting": { + "description": "Lighting description.", + "title": "lighting", + "type": "string" + }, + "medium": { + "description": "Medium description (e.g., photograph, digital art).", + "title": "medium", + "type": "string" + }, + "photo": { + "description": "Optional photographic style notes (e.g., lens, film stock).", + "title": "photo", + "type": "string" + } + }, + "title": "V4StyleDescription", + "type": "object", + "x-drop-nulls": true + }, + "V4CompositionalDeconstruction": { + "description": "The compositional breakdown of a V4 prompt — background plus an ordered list of elements.", + "example": { + "background": "background", + "elements": [ + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + }, + { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + } + ] + }, + "properties": { + "background": { + "description": "Description of the background of the scene.", + "title": "background", + "type": "string" + }, + "elements": { + "description": "Ordered list of elements (objects and text) composing the scene.", + "items": { + "$ref": "#/components/schemas/V4PromptElement" + }, + "title": "elements", + "type": "array" + } + }, + "required": [ + "background", + "elements" + ], + "title": "V4CompositionalDeconstruction", + "type": "object" + }, + "V4PromptElement": { + "description": "A single element in the V4 prompt's compositional deconstruction.\nDiscriminated by the `type` field.\n", + "discriminator": { + "mapping": { + "obj": "#/components/schemas/V4ObjPromptElement", + "text": "#/components/schemas/V4TextPromptElement" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/V4ObjPromptElement" + }, + { + "$ref": "#/components/schemas/V4TextPromptElement" + } + ], + "title": "V4PromptElement", + "x-drop-nulls": true + }, + "V4ObjPromptElement": { + "description": "A non-text element (object, character, background detail) in the V4 prompt layout.", + "example": { + "bbox": [ + 0, + 0, + 1000, + 1000 + ], + "type": "obj", + "desc": "desc" + }, + "properties": { + "type": { + "description": "Discriminator. Must be `obj`.", + "enum": [ + "obj" + ], + "title": "type", + "type": "string" + }, + "bbox": { + "description": "Bounding box for an element, expressed as four integers in `[0, 1000]`\nwith `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are\nnormalized so the canvas is `1000 x 1000` regardless of the final\nresolution.\n", + "example": [ + 0, + 0, + 1000, + 1000 + ], + "items": { + "maximum": 1000, + "minimum": 0, + "type": "integer" + }, + "maxItems": 4, + "minItems": 4, + "title": "V4PromptBbox", + "type": "array" + }, + "desc": { + "description": "Description of the object element.", + "title": "desc", + "type": "string" + } + }, + "required": [ + "desc", + "type" + ], + "title": "V4ObjPromptElement", + "type": "object" + }, + "V4PromptBbox": { + "description": "Bounding box for an element, expressed as four integers in `[0, 1000]`\nwith `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are\nnormalized so the canvas is `1000 x 1000` regardless of the final\nresolution.\n", + "example": [ + 0, + 0, + 1000, + 1000 + ], + "items": { + "maximum": 1000, + "minimum": 0, + "type": "integer" + }, + "maxItems": 4, + "minItems": 4, + "title": "V4PromptBbox", + "type": "array" + }, + "V4TextPromptElement": { + "description": "A text element to render in the V4 prompt layout.", + "properties": { + "type": { + "description": "Discriminator. Must be `text`.", + "enum": [ + "text" + ], + "title": "type", + "type": "string" + }, + "bbox": { + "description": "Bounding box for an element, expressed as four integers in `[0, 1000]`\nwith `[y_min, x_min, y_max, x_max]` semantics (row-first). Values are\nnormalized so the canvas is `1000 x 1000` regardless of the final\nresolution.\n", + "example": [ + 0, + 0, + 1000, + 1000 + ], + "items": { + "maximum": 1000, + "minimum": 0, + "type": "integer" + }, + "maxItems": 4, + "minItems": 4, + "title": "V4PromptBbox", + "type": "array" + }, + "text": { + "description": "The literal text to render in the image.", + "title": "text", + "type": "string" + }, + "desc": { + "description": "Description of the text element (style, role, placement notes).", + "title": "desc", + "type": "string" } }, "required": [ - "dataset_id", - "model_name" + "desc", + "text", + "type" ], - "title": "TrainModelV3AdvancedRequest", + "title": "V4TextPromptElement", "type": "object" }, + "ResolutionV4": { + "description": "The 2K resolutions supported for Ideogram 4.0 image generation.", + "enum": [ + "2048x2048", + "1440x2880", + "2880x1440", + "1664x2496", + "2496x1664", + "1792x2240", + "2240x1792", + "1440x2560", + "2560x1440", + "1600x2560", + "2560x1600", + "1728x2304", + "2304x1728", + "1296x3168", + "3168x1296", + "1152x2944", + "2944x1152", + "1248x3328", + "3328x1248", + "1280x3072", + "3072x1280", + "1024x3072", + "3072x1024" + ], + "example": "2048x2048", + "title": "ResolutionV4", + "type": "string" + }, + "RenderingSpeed": { + "default": "DEFAULT", + "description": "The rendering speed to use.", + "enum": [ + "FLASH", + "TURBO", + "BALANCED", + "DEFAULT", + "QUALITY" + ], + "title": "RenderingSpeed", + "type": "string" + }, + "Seed": { + "description": "Random seed. Set for reproducible generation.", + "example": 12345, + "maximum": 2147483647, + "minimum": 0, + "title": "Seed", + "type": "integer" + }, "MagicPromptOption": { "description": "Determine if MagicPrompt should be used in generating the request or not.", "enum": [ @@ -9265,6 +12304,59 @@ "title": "MagicPromptOption", "type": "string" }, + "ResolutionV4ImageToImage": { + "description": "The resolutions supported for Ideogram 4.0 image-to-image generation.", + "enum": [ + "512x512", + "960x832", + "1024x832", + "960x896", + "1024x896", + "832x960", + "896x960", + "1024x960", + "832x1024", + "896x1024", + "960x1024", + "1024x1024", + "896x1120", + "1120x896", + "864x1152", + "1152x864", + "832x1248", + "1248x832", + "800x1280", + "1280x800", + "720x1280", + "1280x720", + "720x1440", + "1440x720" + ], + "example": "1024x1024", + "title": "ResolutionV4ImageToImage", + "type": "string" + }, + "ResolutionV4Layout": { + "description": "The resolutions supported for Ideogram 4.0 layout-to-image and design generation.", + "enum": [ + "1024x1024", + "896x1120", + "1120x896", + "864x1152", + "1152x864", + "832x1248", + "1248x832", + "800x1280", + "1280x800", + "720x1280", + "1280x720", + "720x1440", + "1440x720" + ], + "example": "1024x1024", + "title": "ResolutionV4Layout", + "type": "string" + }, "Description": { "properties": { "text": { @@ -9283,7 +12375,8 @@ "enum": [ "V_2", "V_3", - "CUSTOM" + "CUSTOM", + "V_4" ], "title": "DescribeModelVersion", "type": "string" @@ -9296,14 +12389,6 @@ "title": "NumImages", "type": "integer" }, - "Seed": { - "description": "Random seed. Set for reproducible generation.", - "example": 12345, - "maximum": 2147483647, - "minimum": 0, - "title": "Seed", - "type": "integer" - }, "StyleType": { "description": "The style type to generate with; this is only applicable for models V_2 and above and should not be specified for model versions V_1.", "enum": [ @@ -9420,19 +12505,6 @@ "title": "AspectRatioV3", "type": "string" }, - "RenderingSpeed": { - "default": "DEFAULT", - "description": "The rendering speed to use.", - "enum": [ - "FLASH", - "TURBO", - "BALANCED", - "DEFAULT", - "QUALITY" - ], - "title": "RenderingSpeed", - "type": "string" - }, "ColorPaletteWithPresetNameOrMembers": { "description": "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). Not supported by V_1, V_1_TURBO, V_2A and V_2A_TURBO models.", "oneOf": [ @@ -9819,6 +12891,31 @@ "title": "AspectRatio", "type": "string" }, + "MagicPromptVersionEnum": { + "description": "The magic prompt version to use when magic prompt option is set to AUTO or ON.", + "enum": [ + "V_0", + "V_0_1", + "V_0_2", + "V_0_3", + "V_0_4", + "V_0_5", + "V_0_6", + "V_0_7", + "V_0_8", + "V4_QWEN_3_5_27B", + "V4_QWEN_3_5_27B_PREFUSED", + "V4_QWEN_3_5_27B_FULL_FINETUNE", + "V4_QWEN_3_5_27B_FULL_FINETUNE_LORA", + "V4_QWEN_3_5_27B_EXPERIMENTAL", + "V4_QWEN_3_5_27B_EXPERIMENTAL_Q36_2P5K", + "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_2P5K", + "V4_QWEN_3_5_27B_EXPERIMENTAL_NONNAS_5K" + ], + "example": "V_0", + "title": "MagicPromptVersionEnum", + "type": "string" + }, "FreeformResolution": { "description": "Output resolution, only used if operations alters image dimensions, such as upscale, crop etc.", "example": "4096x4096", @@ -9826,84 +12923,76 @@ "title": "FreeformResolution", "type": "string" }, - "ResolutionV4": { - "description": "The resolutions supported for Ideogram 4.0.", + "AspectRatioV4": { + "default": "AUTO", + "description": "The aspect ratio for an Ideogram 4.0 magic prompt. `AUTO` lets the\nmodel select the most suitable ratio from the prompt; any other value\npins the ratio. The non-AUTO values are the buckets the 4.0 model\nsupports.\n", "enum": [ - "512x512", - "512x1536", - "576x1408", - "576x1472", - "576x1536", - "640x1344", - "640x1408", - "640x1472", - "640x1536", - "704x1152", - "704x1216", - "704x1280", - "704x1344", - "704x1408", - "704x1472", - "736x1312", - "768x1088", - "768x1216", - "768x1280", - "768x1344", - "800x1280", - "832x960", - "832x1024", - "832x1088", - "832x1152", - "832x1216", - "832x1248", - "864x1152", - "896x960", - "896x1024", - "896x1088", - "896x1120", - "896x1152", - "960x832", - "960x896", - "960x1024", - "960x1088", - "1024x832", - "1024x896", - "1024x960", - "1024x1024", - "1088x768", - "1088x832", - "1088x896", - "1088x960", - "1120x896", - "1152x704", - "1152x832", - "1152x864", - "1152x896", - "1216x704", - "1216x768", - "1216x832", - "1248x832", - "1280x704", - "1280x768", - "1280x800", - "1312x736", - "1344x640", - "1344x704", - "1344x768", - "1408x576", - "1408x640", - "1408x704", - "1472x576", - "1472x640", - "1472x704", - "1536x512", - "1536x576", - "1536x640" + "AUTO", + "1x4", + "1x3", + "1x2", + "9x16", + "10x16", + "2x3", + "3x4", + "4x5", + "1x1", + "5x4", + "4x3", + "3x2", + "16x10", + "16x9", + "2x1", + "3x1", + "4x1" ], - "example": "1280x800", - "title": "ResolutionV4", + "title": "AspectRatioV4", "type": "string" }, + "LayeredAssetTextShadow": { + "description": "Single CSS shadow for V4 vector text. Used by text_shadows and box_shadow. offset_x, offset_y, and blur are in px.", + "example": { + "color": "color", + "blur": 0.2027123, + "offset_x": 9.301444, + "offset_y": 3.6160767 + }, + "properties": { + "color": { + "description": "Shadow hex color. Accepts both 6-hex (#RRGGBB) and 8-hex\n(#RRGGBBAA) — the layered-design extractor emits alpha-included\ncolors for semi-transparent shadows, and stripping alpha would\nlose real visual information. Aligned with the other text-layer\ncolor fields (stroke/border/gradient) which already accept 6,8.\n", + "pattern": "^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$", + "title": "color", + "type": "string" + }, + "offset_x": { + "default": 0, + "description": "Horizontal shadow offset in px.", + "format": "float", + "title": "offset_x", + "type": "number" + }, + "offset_y": { + "default": 0, + "description": "Vertical shadow offset in px.", + "format": "float", + "title": "offset_y", + "type": "number" + }, + "blur": { + "default": 0, + "description": "Shadow blur radius in px.", + "format": "float", + "minimum": 0, + "title": "blur", + "type": "number" + } + }, + "required": [ + "color" + ], + "title": "LayeredAssetTextShadow", + "type": "object" + }, "Price": { "description": "Represents a price.", "example": { @@ -9963,6 +13052,24 @@ "title": "AssetType", "type": "string" }, + "postGenerateDesignV4_200_response": { + "discriminator": { + "mapping": { + "layered": "#/components/schemas/LayeredImageGenerationResponseV3", + "url": "#/components/schemas/ImageGenerationResponseV4Layout" + }, + "propertyName": "response_type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/LayeredImageGenerationResponseV3" + }, + { + "$ref": "#/components/schemas/ImageGenerationResponseV4Layout" + } + ], + "title": "postGenerateDesignV4_200_response" + }, "postInternalTesting_200_response": { "example": { "response_content": "response_content" @@ -9976,6 +13083,29 @@ "title": "postInternalTesting_200_response", "type": "object" }, + "MagicPromptRequest_messages_inner": { + "properties": { + "role": { + "enum": [ + "system", + "user", + "assistant" + ], + "title": "role", + "type": "string" + }, + "content": { + "title": "content", + "type": "string" + } + }, + "required": [ + "content", + "role" + ], + "title": "MagicPromptRequest_messages_inner", + "type": "object" + }, "InternalBatchResultsResponse_results_inner": { "example": { "image_url": "image_url",