diff --git a/src/libs/Gamma/Generated/Gamma.AutoSDKHttpResponse.g.cs b/src/libs/Gamma/Generated/Gamma.AutoSDKHttpResponse.g.cs
new file mode 100644
index 0000000..32974bb
--- /dev/null
+++ b/src/libs/Gamma/Generated/Gamma.AutoSDKHttpResponse.g.cs
@@ -0,0 +1,121 @@
+
+#nullable enable
+
+namespace Gamma
+{
+ ///
+ /// 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/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs
index 4c06cb2..5f51a93 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs
@@ -51,6 +51,29 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
///
public async global::System.Threading.Tasks.Task CreateFromTemplateGenerationAsync(
+ global::Gamma.FromTemplateGeneration request,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateFromTemplateGenerationAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create generation from template
+ /// Creates an asynchronous generation job from a template Gamma with variable substitution.
+ ///
+ ///
+ /// 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> CreateFromTemplateGenerationAsResponseAsync(
+
global::Gamma.FromTemplateGeneration request,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -85,6 +108,7 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::Gamma.PathBuilder(
path: "/v1.0/generations/from-template",
baseUri: HttpClient.BaseAddress);
@@ -164,6 +188,8 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +200,11 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +222,8 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
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 ProcessCreateFromTemplateGenerationResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +242,11 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
__attempt < __maxAttempts &&
global::Gamma.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Gamma.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +263,15 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
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::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +311,8 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +333,8 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
@@ -449,9 +491,13 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::Gamma.FromTemplateGenerationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::Gamma.FromTemplateGenerationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -479,9 +525,13 @@ partial void ProcessCreateFromTemplateGenerationResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::Gamma.FromTemplateGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::Gamma.FromTemplateGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs
index c57bb3f..75c270b 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs
@@ -51,6 +51,29 @@ partial void ProcessCreateGenerationResponseContent(
///
public async global::System.Threading.Tasks.Task CreateGenerationAsync(
+ global::Gamma.Generation request,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateGenerationAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create async generation
+ /// Creates an asynchronous generation job from provided text input. Returns a generation ID that can be used to poll for 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> CreateGenerationAsResponseAsync(
+
global::Gamma.Generation request,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -85,6 +108,7 @@ partial void ProcessCreateGenerationResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::Gamma.PathBuilder(
path: "/v1.0/generations",
baseUri: HttpClient.BaseAddress);
@@ -164,6 +188,8 @@ partial void ProcessCreateGenerationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +200,11 @@ partial void ProcessCreateGenerationResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +222,8 @@ partial void ProcessCreateGenerationResponseContent(
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 ProcessCreateGenerationResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +242,11 @@ partial void ProcessCreateGenerationResponseContent(
__attempt < __maxAttempts &&
global::Gamma.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Gamma.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +263,15 @@ partial void ProcessCreateGenerationResponseContent(
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::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +311,8 @@ partial void ProcessCreateGenerationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +333,8 @@ partial void ProcessCreateGenerationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
@@ -449,9 +491,13 @@ partial void ProcessCreateGenerationResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::Gamma.CreateGenerationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::Gamma.CreateGenerationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -479,9 +525,13 @@ partial void ProcessCreateGenerationResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::Gamma.CreateGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::Gamma.CreateGenerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs
index 7846656..65f367c 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs
@@ -53,6 +53,27 @@ partial void ProcessGetGenerationStatusResponseContent(
string id,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await GetGenerationStatusAsResponseAsync(
+ id: id,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Get generation status
+ /// Retrieves the current status of a generation job. Poll this endpoint until status is "completed" or "failed".
+ ///
+ ///
+ /// 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> GetGenerationStatusAsResponseAsync(
+ string id,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -82,6 +103,7 @@ partial void ProcessGetGenerationStatusResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::Gamma.PathBuilder(
path: $"/v1.0/generations/{id}",
baseUri: HttpClient.BaseAddress);
@@ -155,6 +177,8 @@ partial void ProcessGetGenerationStatusResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -165,6 +189,11 @@ partial void ProcessGetGenerationStatusResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -182,6 +211,8 @@ partial void ProcessGetGenerationStatusResponseContent(
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 ProcessGetGenerationStatusResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -201,6 +231,11 @@ partial void ProcessGetGenerationStatusResponseContent(
__attempt < __maxAttempts &&
global::Gamma.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Gamma.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -217,14 +252,15 @@ partial void ProcessGetGenerationStatusResponseContent(
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::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -264,6 +300,8 @@ partial void ProcessGetGenerationStatusResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -284,6 +322,8 @@ partial void ProcessGetGenerationStatusResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
@@ -374,9 +414,13 @@ partial void ProcessGetGenerationStatusResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::Gamma.GenerationStatusResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::Gamma.GenerationStatusResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -404,9 +448,13 @@ partial void ProcessGetGenerationStatusResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::Gamma.GenerationStatusResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::Gamma.GenerationStatusResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs
index 10a133d..efe3209 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs
@@ -61,6 +61,33 @@ partial void ProcessListFoldersResponseContent(
string? after = default,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListFoldersAsResponseAsync(
+ query: query,
+ limit: limit,
+ after: after,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List folders
+ /// Lists all folders the authenticated user is a member of within the workspace.
+ ///
+ ///
+ ///
+ ///
+ /// 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> ListFoldersAsResponseAsync(
+ string? query = default,
+ double? limit = default,
+ string? after = default,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -92,13 +119,14 @@ partial void ProcessListFoldersResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::Gamma.PathBuilder(
path: "/v1.0/folders",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("query", query)
.AddOptionalParameter("limit", limit?.ToString())
- .AddOptionalParameter("after", after)
+ .AddOptionalParameter("after", after)
;
var __path = __pathBuilder.ToString();
__path = global::Gamma.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -172,6 +200,8 @@ partial void ProcessListFoldersResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -182,6 +212,11 @@ partial void ProcessListFoldersResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -199,6 +234,8 @@ partial void ProcessListFoldersResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -208,8 +245,7 @@ partial void ProcessListFoldersResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -218,6 +254,11 @@ partial void ProcessListFoldersResponseContent(
__attempt < __maxAttempts &&
global::Gamma.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Gamma.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -234,14 +275,15 @@ partial void ProcessListFoldersResponseContent(
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::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -281,6 +323,8 @@ partial void ProcessListFoldersResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -301,6 +345,8 @@ partial void ProcessListFoldersResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
@@ -358,9 +404,13 @@ partial void ProcessListFoldersResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::Gamma.ListFoldersResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::Gamma.ListFoldersResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -388,9 +438,13 @@ partial void ProcessListFoldersResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::Gamma.ListFoldersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::Gamma.ListFoldersResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs
index 9f24033..90f8a06 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs
@@ -61,6 +61,33 @@ partial void ProcessListThemesResponseContent(
string? after = default,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListThemesAsResponseAsync(
+ query: query,
+ limit: limit,
+ after: after,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List themes
+ /// Lists all themes available to the workspace, including standard themes and custom workspace themes.
+ ///
+ ///
+ ///
+ ///
+ /// 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> ListThemesAsResponseAsync(
+ string? query = default,
+ double? limit = default,
+ string? after = default,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -92,13 +119,14 @@ partial void ProcessListThemesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::Gamma.PathBuilder(
path: "/v1.0/themes",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("query", query)
.AddOptionalParameter("limit", limit?.ToString())
- .AddOptionalParameter("after", after)
+ .AddOptionalParameter("after", after)
;
var __path = __pathBuilder.ToString();
__path = global::Gamma.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -172,6 +200,8 @@ partial void ProcessListThemesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -182,6 +212,11 @@ partial void ProcessListThemesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -199,6 +234,8 @@ partial void ProcessListThemesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -208,8 +245,7 @@ partial void ProcessListThemesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -218,6 +254,11 @@ partial void ProcessListThemesResponseContent(
__attempt < __maxAttempts &&
global::Gamma.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::Gamma.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::Gamma.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Gamma.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -234,14 +275,15 @@ partial void ProcessListThemesResponseContent(
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::Gamma.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -281,6 +323,8 @@ partial void ProcessListThemesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -301,6 +345,8 @@ partial void ProcessListThemesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
@@ -358,9 +404,13 @@ partial void ProcessListThemesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::Gamma.ListThemesResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::Gamma.ListThemesResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -388,9 +438,13 @@ partial void ProcessListThemesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::Gamma.ListThemesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::Gamma.ListThemesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::Gamma.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::Gamma.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/Gamma/Generated/Gamma.GammaClient.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.g.cs
index da4b430..4c3a51f 100644
--- a/src/libs/Gamma/Generated/Gamma.GammaClient.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.GammaClient.g.cs
@@ -73,10 +73,10 @@ public GammaClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public GammaClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::Gamma.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::Gamma.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateFromTemplateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateFromTemplateGeneration.g.cs
index a1aff8c..6434f08 100644
--- a/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateFromTemplateGeneration.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateFromTemplateGeneration.g.cs
@@ -21,6 +21,19 @@ public partial interface IGammaClient
/// Create generation from template
/// Creates an asynchronous generation job from a template Gamma with variable substitution.
///
+ ///
+ /// 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> CreateFromTemplateGenerationAsResponseAsync(
+
+ global::Gamma.FromTemplateGeneration request,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Create generation from template
+ /// Creates an asynchronous generation job from a template Gamma with variable substitution.
+ ///
///
/// Export format for automatic export after generation
///
diff --git a/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateGeneration.g.cs
index e3db96f..3455372 100644
--- a/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateGeneration.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.IGammaClient.CreateGeneration.g.cs
@@ -21,6 +21,19 @@ public partial interface IGammaClient
/// Create async generation
/// Creates an asynchronous generation job from provided text input. Returns a generation ID that can be used to poll for 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> CreateGenerationAsResponseAsync(
+
+ global::Gamma.Generation request,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Create async generation
+ /// Creates an asynchronous generation job from provided text input. Returns a generation ID that can be used to poll for status.
+ ///
///
/// How to interpret the input text
///
diff --git a/src/libs/Gamma/Generated/Gamma.IGammaClient.GetGenerationStatus.g.cs b/src/libs/Gamma/Generated/Gamma.IGammaClient.GetGenerationStatus.g.cs
index 9ea9c89..996e6ac 100644
--- a/src/libs/Gamma/Generated/Gamma.IGammaClient.GetGenerationStatus.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.IGammaClient.GetGenerationStatus.g.cs
@@ -16,5 +16,17 @@ public partial interface IGammaClient
string id,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// Get generation status
+ /// Retrieves the current status of a generation job. Poll this endpoint until status is "completed" or "failed".
+ ///
+ ///
+ /// 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> GetGenerationStatusAsResponseAsync(
+ string id,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Gamma/Generated/Gamma.IGammaClient.ListFolders.g.cs b/src/libs/Gamma/Generated/Gamma.IGammaClient.ListFolders.g.cs
index fe553bc..e3e90b4 100644
--- a/src/libs/Gamma/Generated/Gamma.IGammaClient.ListFolders.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.IGammaClient.ListFolders.g.cs
@@ -20,5 +20,21 @@ public partial interface IGammaClient
string? after = default,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// List folders
+ /// Lists all folders the authenticated user is a member of within the workspace.
+ ///
+ ///
+ ///
+ ///
+ /// 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> ListFoldersAsResponseAsync(
+ string? query = default,
+ double? limit = default,
+ string? after = default,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Gamma/Generated/Gamma.IGammaClient.ListThemes.g.cs b/src/libs/Gamma/Generated/Gamma.IGammaClient.ListThemes.g.cs
index e5f786e..0e5687e 100644
--- a/src/libs/Gamma/Generated/Gamma.IGammaClient.ListThemes.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.IGammaClient.ListThemes.g.cs
@@ -20,5 +20,21 @@ public partial interface IGammaClient
string? after = default,
global::Gamma.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
+ ///
+ /// List themes
+ /// Lists all themes available to the workspace, including standard themes and custom workspace themes.
+ ///
+ ///
+ ///
+ ///
+ /// 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> ListThemesAsResponseAsync(
+ string? query = default,
+ double? limit = default,
+ string? after = default,
+ global::Gamma.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Gamma/Generated/Gamma.OptionsSupport.g.cs b/src/libs/Gamma/Generated/Gamma.OptionsSupport.g.cs
index 619dc34..d96ffe4 100644
--- a/src/libs/Gamma/Generated/Gamma.OptionsSupport.g.cs
+++ b/src/libs/Gamma/Generated/Gamma.OptionsSupport.g.cs
@@ -101,9 +101,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 +267,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 +300,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::Gamma.AutoSDKHookContext
@@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport
Attempt = attempt,
MaxAttempts = maxAttempts,
WillRetry = willRetry,
+ RetryDelay = retryDelay,
+ RetryReason = retryReason ?? string.Empty,
CancellationToken = cancellationToken,
};
}
@@ -338,19 +388,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::Gamma.AutoSDKClientOptions clientOptions,
global::Gamma.AutoSDKRequestOptions? requestOptions,
+ global::System.Net.Http.HttpResponseMessage? response,
+ int attempt)
+ {
+ var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Gamma.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::Gamma.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(