From 29dac5a6e389b00dc002e9860e231e1a741f1280 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 04:11:49 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Gamma/Generated/Gamma.Exceptions.g.cs | 134 ++++++++++++++++++ ...maClient.CreateFromTemplateGeneration.g.cs | 76 +++++----- .../Gamma.GammaClient.CreateGeneration.g.cs | 76 +++++----- ...Gamma.GammaClient.GetGenerationStatus.g.cs | 50 +++---- .../Gamma.GammaClient.ListFolders.g.cs | 37 +++-- .../Gamma.GammaClient.ListThemes.g.cs | 37 +++-- 6 files changed, 256 insertions(+), 154 deletions(-) diff --git a/src/libs/Gamma/Generated/Gamma.Exceptions.g.cs b/src/libs/Gamma/Generated/Gamma.Exceptions.g.cs index b805499..cd58e85 100644 --- a/src/libs/Gamma/Generated/Gamma.Exceptions.g.cs +++ b/src/libs/Gamma/Generated/Gamma.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::Gamma.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Gamma.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::Gamma.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::Gamma.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::Gamma.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Gamma.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::Gamma.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::Gamma.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/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs index 5f51a93..2691f35 100644 --- a/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs +++ b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateFromTemplateGeneration.g.cs @@ -358,17 +358,16 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( __exception_400 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -391,17 +390,16 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( __exception_401 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -424,17 +422,16 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( __exception_402 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -457,17 +454,16 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( __exception_403 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -501,17 +497,15 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( } catch (global::System.Exception __ex) { - throw new global::Gamma.ApiException( + throw global::Gamma.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 @@ -548,17 +542,15 @@ partial void ProcessCreateFromTemplateGenerationResponseContent( { } - throw new global::Gamma.ApiException( + throw global::Gamma.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/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs index 75c270b..bb4912b 100644 --- a/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs +++ b/src/libs/Gamma/Generated/Gamma.GammaClient.CreateGeneration.g.cs @@ -358,17 +358,16 @@ partial void ProcessCreateGenerationResponseContent( __exception_400 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -391,17 +390,16 @@ partial void ProcessCreateGenerationResponseContent( __exception_401 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -424,17 +422,16 @@ partial void ProcessCreateGenerationResponseContent( __exception_402 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -457,17 +454,16 @@ partial void ProcessCreateGenerationResponseContent( __exception_403 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -501,17 +497,15 @@ partial void ProcessCreateGenerationResponseContent( } catch (global::System.Exception __ex) { - throw new global::Gamma.ApiException( + throw global::Gamma.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 @@ -548,17 +542,15 @@ partial void ProcessCreateGenerationResponseContent( { } - throw new global::Gamma.ApiException( + throw global::Gamma.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/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs index 65f367c..1b82986 100644 --- a/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs +++ b/src/libs/Gamma/Generated/Gamma.GammaClient.GetGenerationStatus.g.cs @@ -347,17 +347,16 @@ partial void ProcessGetGenerationStatusResponseContent( __exception_401 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -380,17 +379,16 @@ partial void ProcessGetGenerationStatusResponseContent( __exception_404 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -424,17 +422,15 @@ partial void ProcessGetGenerationStatusResponseContent( } catch (global::System.Exception __ex) { - throw new global::Gamma.ApiException( + throw global::Gamma.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 @@ -471,17 +467,15 @@ partial void ProcessGetGenerationStatusResponseContent( { } - throw new global::Gamma.ApiException( + throw global::Gamma.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/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs index efe3209..dae97c8 100644 --- a/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs +++ b/src/libs/Gamma/Generated/Gamma.GammaClient.ListFolders.g.cs @@ -370,17 +370,16 @@ partial void ProcessListFoldersResponseContent( __exception_401 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -414,17 +413,15 @@ partial void ProcessListFoldersResponseContent( } catch (global::System.Exception __ex) { - throw new global::Gamma.ApiException( + throw global::Gamma.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 @@ -461,17 +458,15 @@ partial void ProcessListFoldersResponseContent( { } - throw new global::Gamma.ApiException( + throw global::Gamma.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/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs b/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs index 90f8a06..d25fc63 100644 --- a/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs +++ b/src/libs/Gamma/Generated/Gamma.GammaClient.ListThemes.g.cs @@ -370,17 +370,16 @@ partial void ProcessListThemesResponseContent( __exception_401 = __ex; } - throw new global::Gamma.ApiException( + + throw global::Gamma.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) @@ -414,17 +413,15 @@ partial void ProcessListThemesResponseContent( } catch (global::System.Exception __ex) { - throw new global::Gamma.ApiException( + throw global::Gamma.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 @@ -461,17 +458,15 @@ partial void ProcessListThemesResponseContent( { } - throw new global::Gamma.ApiException( + throw global::Gamma.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)); } }