Skip to content

Commit b7ba21c

Browse files
author
github-actions[bot]
committed
feat: Updated OpenAPI spec
1 parent 78080cc commit b7ba21c

169 files changed

Lines changed: 37581 additions & 2008 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
2+
#nullable enable
3+
4+
namespace Ideogram
5+
{
6+
/// <summary>
7+
/// Represents a successful HTTP response with status code and headers.
8+
/// </summary>
9+
public partial class AutoSDKHttpResponse
10+
{
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
13+
/// </summary>
14+
public AutoSDKHttpResponse(
15+
global::System.Net.HttpStatusCode statusCode,
16+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers)
17+
: this(
18+
statusCode: statusCode,
19+
headers: headers,
20+
requestUri: null)
21+
{
22+
}
23+
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse"/> class.
26+
/// </summary>
27+
public AutoSDKHttpResponse(
28+
global::System.Net.HttpStatusCode statusCode,
29+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
30+
global::System.Uri? requestUri)
31+
{
32+
StatusCode = statusCode;
33+
Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers));
34+
RequestUri = requestUri;
35+
}
36+
37+
/// <summary>
38+
/// Gets the HTTP status code.
39+
/// </summary>
40+
public global::System.Net.HttpStatusCode StatusCode { get; }
41+
/// <summary>
42+
/// Gets the response headers.
43+
/// </summary>
44+
public global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> Headers { get; }
45+
/// <summary>
46+
/// Gets the final request URI associated with the response.
47+
/// </summary>
48+
public global::System.Uri? RequestUri { get; }
49+
50+
internal static global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> CreateHeaders(
51+
global::System.Net.Http.HttpResponseMessage response)
52+
{
53+
response = response ?? throw new global::System.ArgumentNullException(nameof(response));
54+
55+
var headers = global::System.Linq.Enumerable.ToDictionary(
56+
response.Headers,
57+
static header => header.Key,
58+
static header => (global::System.Collections.Generic.IEnumerable<string>)global::System.Linq.Enumerable.ToArray(header.Value),
59+
global::System.StringComparer.OrdinalIgnoreCase);
60+
61+
if (response.Content?.Headers == null)
62+
{
63+
return headers;
64+
}
65+
66+
foreach (var header in response.Content.Headers)
67+
{
68+
if (headers.TryGetValue(header.Key, out var existingValues))
69+
{
70+
headers[header.Key] = global::System.Linq.Enumerable.ToArray(
71+
global::System.Linq.Enumerable.Concat(existingValues, header.Value));
72+
}
73+
else
74+
{
75+
headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value);
76+
}
77+
}
78+
79+
return headers;
80+
}
81+
}
82+
83+
/// <summary>
84+
/// Represents a successful HTTP response with status code, headers, and body.
85+
/// </summary>
86+
public partial class AutoSDKHttpResponse<T> : AutoSDKHttpResponse
87+
{
88+
/// <summary>
89+
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
90+
/// </summary>
91+
public AutoSDKHttpResponse(
92+
global::System.Net.HttpStatusCode statusCode,
93+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
94+
T body)
95+
: this(
96+
statusCode: statusCode,
97+
headers: headers,
98+
requestUri: null,
99+
body: body)
100+
{
101+
}
102+
103+
/// <summary>
104+
/// Initializes a new instance of the <see cref="AutoSDKHttpResponse{T}"/> class.
105+
/// </summary>
106+
public AutoSDKHttpResponse(
107+
global::System.Net.HttpStatusCode statusCode,
108+
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>> headers,
109+
global::System.Uri? requestUri,
110+
T body)
111+
: base(statusCode, headers, requestUri)
112+
{
113+
Body = body;
114+
}
115+
116+
/// <summary>
117+
/// Gets the response body.
118+
/// </summary>
119+
public T Body { get; }
120+
}
121+
}

src/libs/Ideogram/Generated/Ideogram.BatchClient.GetMaybeBatchResults.g.cs

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,27 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
5353
string jobId,
5454
global::Ideogram.AutoSDKRequestOptions? requestOptions = default,
5555
global::System.Threading.CancellationToken cancellationToken = default)
56+
{
57+
var __response = await GetMaybeBatchResultsAsResponseAsync(
58+
jobId: jobId,
59+
requestOptions: requestOptions,
60+
cancellationToken: cancellationToken
61+
).ConfigureAwait(false);
62+
63+
return __response.Body;
64+
}
65+
/// <summary>
66+
/// Get Batch Magic Prompt Job Results if available.<br/>
67+
/// Gets the results of a batch magic prompt job if available.
68+
/// </summary>
69+
/// <param name="jobId"></param>
70+
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
71+
/// <param name="cancellationToken">The token to cancel the operation with</param>
72+
/// <exception cref="global::Ideogram.ApiException"></exception>
73+
public async global::System.Threading.Tasks.Task<global::Ideogram.AutoSDKHttpResponse<global::Ideogram.InternalBatchResultsResponse>> GetMaybeBatchResultsAsResponseAsync(
74+
string jobId,
75+
global::Ideogram.AutoSDKRequestOptions? requestOptions = default,
76+
global::System.Threading.CancellationToken cancellationToken = default)
5677
{
5778
PrepareArguments(
5879
client: HttpClient);
@@ -82,6 +103,7 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
82103

83104
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
84105
{
106+
85107
var __pathBuilder = new global::Ideogram.PathBuilder(
86108
path: $"/internal/batch/get-maybe-batch-results/{jobId}",
87109
baseUri: HttpClient.BaseAddress);
@@ -155,6 +177,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
155177
attempt: __attempt,
156178
maxAttempts: __maxAttempts,
157179
willRetry: false,
180+
retryDelay: null,
181+
retryReason: global::System.String.Empty,
158182
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
159183
try
160184
{
@@ -165,6 +189,11 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
165189
}
166190
catch (global::System.Net.Http.HttpRequestException __exception)
167191
{
192+
var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay(
193+
clientOptions: Options,
194+
requestOptions: requestOptions,
195+
response: null,
196+
attempt: __attempt);
168197
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
169198
await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
170199
clientOptions: Options,
@@ -182,6 +211,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
182211
attempt: __attempt,
183212
maxAttempts: __maxAttempts,
184213
willRetry: __willRetry,
214+
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
215+
retryReason: "exception",
185216
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
186217
if (!__willRetry)
187218
{
@@ -191,8 +222,7 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
191222
__httpRequest.Dispose();
192223
__httpRequest = null;
193224
await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
194-
clientOptions: Options,
195-
requestOptions: requestOptions,
225+
retryDelay: __retryDelay,
196226
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
197227
continue;
198228
}
@@ -201,6 +231,11 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
201231
__attempt < __maxAttempts &&
202232
global::Ideogram.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
203233
{
234+
var __retryDelay = global::Ideogram.AutoSDKRequestOptionsSupport.GetRetryDelay(
235+
clientOptions: Options,
236+
requestOptions: requestOptions,
237+
response: __response,
238+
attempt: __attempt);
204239
await global::Ideogram.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
205240
clientOptions: Options,
206241
context: global::Ideogram.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -217,14 +252,15 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
217252
attempt: __attempt,
218253
maxAttempts: __maxAttempts,
219254
willRetry: true,
255+
retryDelay: __retryDelay,
256+
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
220257
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
221258
__response.Dispose();
222259
__response = null;
223260
__httpRequest.Dispose();
224261
__httpRequest = null;
225262
await global::Ideogram.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
226-
clientOptions: Options,
227-
requestOptions: requestOptions,
263+
retryDelay: __retryDelay,
228264
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
229265
continue;
230266
}
@@ -264,6 +300,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
264300
attempt: __attemptNumber,
265301
maxAttempts: __maxAttempts,
266302
willRetry: false,
303+
retryDelay: null,
304+
retryReason: global::System.String.Empty,
267305
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
268306
}
269307
else
@@ -284,6 +322,8 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
284322
attempt: __attemptNumber,
285323
maxAttempts: __maxAttempts,
286324
willRetry: false,
325+
retryDelay: null,
326+
retryReason: global::System.String.Empty,
287327
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
288328
}
289329
//
@@ -440,9 +480,13 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
440480
{
441481
__response.EnsureSuccessStatusCode();
442482

443-
return
444-
global::Ideogram.InternalBatchResultsResponse.FromJson(__content, JsonSerializerContext) ??
483+
var __value = global::Ideogram.InternalBatchResultsResponse.FromJson(__content, JsonSerializerContext) ??
445484
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
485+
return new global::Ideogram.AutoSDKHttpResponse<global::Ideogram.InternalBatchResultsResponse>(
486+
statusCode: __response.StatusCode,
487+
headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response),
488+
requestUri: __response.RequestMessage?.RequestUri,
489+
body: __value);
446490
}
447491
catch (global::System.Exception __ex)
448492
{
@@ -470,9 +514,13 @@ partial void ProcessGetMaybeBatchResultsResponseContent(
470514
#endif
471515
).ConfigureAwait(false);
472516

473-
return
474-
await global::Ideogram.InternalBatchResultsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
517+
var __value = await global::Ideogram.InternalBatchResultsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
475518
throw new global::System.InvalidOperationException("Response deserialization failed.");
519+
return new global::Ideogram.AutoSDKHttpResponse<global::Ideogram.InternalBatchResultsResponse>(
520+
statusCode: __response.StatusCode,
521+
headers: global::Ideogram.AutoSDKHttpResponse.CreateHeaders(__response),
522+
requestUri: __response.RequestMessage?.RequestUri,
523+
body: __value);
476524
}
477525
catch (global::System.Exception __ex)
478526
{

0 commit comments

Comments
 (0)