From 616b3b4d5c8974be4835f9d54cf0ad36d22c64e6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 06:32:22 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Generated/Guardrails.Exceptions.g.cs | 134 ++++++++++++++++++ .../Guardrails.GuardClient.CreateGuard.g.cs | 39 +++-- .../Guardrails.GuardClient.DeleteGuard.g.cs | 39 +++-- .../Guardrails.GuardClient.GetGuard.g.cs | 39 +++-- ...uardrails.GuardClient.GetGuardHistory.g.cs | 39 +++-- .../Guardrails.GuardClient.GetGuards.g.cs | 39 +++-- .../Guardrails.GuardClient.UpdateGuard.g.cs | 39 +++-- ...ils.OpenaiClient.OpenaiChatCompletion.g.cs | 39 +++-- ...rails.ServiceHealthClient.HealthCheck.g.cs | 39 +++-- .../Guardrails.ValidateClient.Validate.g.cs | 39 +++-- 10 files changed, 287 insertions(+), 198 deletions(-) diff --git a/src/libs/Guardrails/Generated/Guardrails.Exceptions.g.cs b/src/libs/Guardrails/Generated/Guardrails.Exceptions.g.cs index 6f25128..67a7e20 100644 --- a/src/libs/Guardrails/Generated/Guardrails.Exceptions.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.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::Guardrails.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Guardrails.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::Guardrails.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::Guardrails.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::Guardrails.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::Guardrails.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::Guardrails.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::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.CreateGuard.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.CreateGuard.g.cs index 03fa54f..dde9e9b 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.CreateGuard.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.CreateGuard.g.cs @@ -360,18 +360,17 @@ partial void ProcessCreateGuardResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -405,17 +404,15 @@ partial void ProcessCreateGuardResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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,17 +449,15 @@ partial void ProcessCreateGuardResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.DeleteGuard.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.DeleteGuard.g.cs index a06c8fc..588451a 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.DeleteGuard.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.DeleteGuard.g.cs @@ -349,18 +349,17 @@ partial void ProcessDeleteGuardResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -394,17 +393,15 @@ partial void ProcessDeleteGuardResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 @@ -441,17 +438,15 @@ partial void ProcessDeleteGuardResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.GetGuard.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuard.g.cs index 92b503c..d77e0cc 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuard.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuard.g.cs @@ -361,18 +361,17 @@ partial void ProcessGetGuardResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -406,17 +405,15 @@ partial void ProcessGetGuardResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 @@ -453,17 +450,15 @@ partial void ProcessGetGuardResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.GetGuardHistory.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuardHistory.g.cs index 483a16d..a870d66 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuardHistory.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuardHistory.g.cs @@ -358,18 +358,17 @@ partial void ProcessGetGuardHistoryResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -403,17 +402,15 @@ partial void ProcessGetGuardHistoryResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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,17 +447,15 @@ partial void ProcessGetGuardHistoryResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.GetGuards.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuards.g.cs index 8eb48b1..36bb454 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuards.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.GetGuards.g.cs @@ -340,18 +340,17 @@ partial void ProcessGetGuardsResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -385,17 +384,15 @@ partial void ProcessGetGuardsResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 @@ -432,17 +429,15 @@ partial void ProcessGetGuardsResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.GuardClient.UpdateGuard.g.cs b/src/libs/Guardrails/Generated/Guardrails.GuardClient.UpdateGuard.g.cs index 0faa934..0baa830 100644 --- a/src/libs/Guardrails/Generated/Guardrails.GuardClient.UpdateGuard.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.GuardClient.UpdateGuard.g.cs @@ -369,18 +369,17 @@ partial void ProcessUpdateGuardResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + 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 ProcessUpdateGuardResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 ProcessUpdateGuardResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.OpenaiClient.OpenaiChatCompletion.g.cs b/src/libs/Guardrails/Generated/Guardrails.OpenaiClient.OpenaiChatCompletion.g.cs index eab0b7c..b10e0ab 100644 --- a/src/libs/Guardrails/Generated/Guardrails.OpenaiClient.OpenaiChatCompletion.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.OpenaiClient.OpenaiChatCompletion.g.cs @@ -369,18 +369,17 @@ partial void ProcessOpenaiChatCompletionResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + 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 ProcessOpenaiChatCompletionResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 ProcessOpenaiChatCompletionResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.ServiceHealthClient.HealthCheck.g.cs b/src/libs/Guardrails/Generated/Guardrails.ServiceHealthClient.HealthCheck.g.cs index 980219f..6b1874f 100644 --- a/src/libs/Guardrails/Generated/Guardrails.ServiceHealthClient.HealthCheck.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.ServiceHealthClient.HealthCheck.g.cs @@ -340,18 +340,17 @@ partial void ProcessHealthCheckResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -385,17 +384,15 @@ partial void ProcessHealthCheckResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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 @@ -432,17 +429,15 @@ partial void ProcessHealthCheckResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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/Guardrails/Generated/Guardrails.ValidateClient.Validate.g.cs b/src/libs/Guardrails/Generated/Guardrails.ValidateClient.Validate.g.cs index 8cd73ca..807e04b 100644 --- a/src/libs/Guardrails/Generated/Guardrails.ValidateClient.Validate.g.cs +++ b/src/libs/Guardrails/Generated/Guardrails.ValidateClient.Validate.g.cs @@ -384,18 +384,17 @@ partial void ProcessValidateResponseContent( __exception_default = __ex; } - throw new global::Guardrails.ApiException( + + throw global::Guardrails.ApiException.Create( + statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, - statusCode: __response.StatusCode) - { - ResponseBody = __content_default, - ResponseObject = __value_default, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -429,17 +428,15 @@ partial void ProcessValidateResponseContent( } catch (global::System.Exception __ex) { - throw new global::Guardrails.ApiException( + throw global::Guardrails.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,17 +473,15 @@ partial void ProcessValidateResponseContent( { } - throw new global::Guardrails.ApiException( + throw global::Guardrails.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)); } }