From 04e2ad5d966aa9b86b01c05613b85ed97519f3ca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 06:32:09 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../EachLabs.AiModelsClient.GetModel.g.cs | 69 ++++----- .../EachLabs.AiModelsClient.ListModels.g.cs | 54 ++++--- ...delsPredictionClient.CreatePrediction.g.cs | 54 ++++--- ...iModelsPredictionClient.GetPrediction.g.cs | 54 ++++--- .../Generated/EachLabs.Exceptions.g.cs | 134 ++++++++++++++++++ .../EachLabs.WebhooksClient.GetWebhook.g.cs | 69 ++++----- .../EachLabs.WebhooksClient.ListWebhooks.g.cs | 54 ++++--- 7 files changed, 292 insertions(+), 196 deletions(-) diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs index 849f226..c4b03a2 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs @@ -354,18 +354,17 @@ partial void ProcessGetModelResponseContent( __exception_400 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Resource not found if ((int)__response.StatusCode == 404) @@ -392,18 +391,17 @@ partial void ProcessGetModelResponseContent( __exception_404 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseObject: __value_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -430,18 +428,17 @@ partial void ProcessGetModelResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -475,17 +472,15 @@ partial void ProcessGetModelResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content ?? __response.ReasonPhrase ?? string.Empty, innerException: __ex, - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } } else @@ -522,17 +517,15 @@ partial void ProcessGetModelResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs index 97f0c72..c79901e 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs @@ -382,18 +382,17 @@ partial void ProcessListModelsResponseContent( __exception_400 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -420,18 +419,17 @@ partial void ProcessListModelsResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -465,17 +463,15 @@ partial void ProcessListModelsResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.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 @@ -512,17 +508,15 @@ partial void ProcessListModelsResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs index 6195513..e7f4cad 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs @@ -364,18 +364,17 @@ partial void ProcessCreatePredictionResponseContent( __exception_400 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -402,18 +401,17 @@ partial void ProcessCreatePredictionResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -447,17 +445,15 @@ partial void ProcessCreatePredictionResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.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 @@ -494,17 +490,15 @@ partial void ProcessCreatePredictionResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs index 4954418..85a4cfd 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs @@ -351,18 +351,17 @@ partial void ProcessGetPredictionResponseContent( __exception_404 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseObject: __value_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -389,18 +388,17 @@ partial void ProcessGetPredictionResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -434,17 +432,15 @@ partial void ProcessGetPredictionResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.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 @@ -481,17 +477,15 @@ partial void ProcessGetPredictionResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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/EachLabs/Generated/EachLabs.Exceptions.g.cs b/src/libs/EachLabs/Generated/EachLabs.Exceptions.g.cs index 0822c3b..42df42d 100644 --- a/src/libs/EachLabs/Generated/EachLabs.Exceptions.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.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::EachLabs.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::EachLabs.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::EachLabs.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::EachLabs.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::EachLabs.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::EachLabs.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::EachLabs.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::EachLabs.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/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs index c39a58c..236a34f 100644 --- a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs @@ -351,18 +351,17 @@ partial void ProcessGetWebhookResponseContent( __exception_400 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_400, - statusCode: __response.StatusCode) - { - ResponseBody = __content_400, - ResponseObject = __value_400, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_400, + responseObject: __value_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Resource not found if ((int)__response.StatusCode == 404) @@ -389,18 +388,17 @@ partial void ProcessGetWebhookResponseContent( __exception_404 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_404, - statusCode: __response.StatusCode) - { - ResponseBody = __content_404, - ResponseObject = __value_404, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_404, + responseObject: __value_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -427,18 +425,17 @@ partial void ProcessGetWebhookResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -472,17 +469,15 @@ partial void ProcessGetWebhookResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.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 @@ -519,17 +514,15 @@ partial void ProcessGetWebhookResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs index 0a3cf74..f8c65a7 100644 --- a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs @@ -372,18 +372,17 @@ partial void ProcessListWebhooksResponseContent( __exception_401 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_401, - statusCode: __response.StatusCode) - { - ResponseBody = __content_401, - ResponseObject = __value_401, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_401, + responseObject: __value_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // Internal server error if ((int)__response.StatusCode == 500) @@ -410,18 +409,17 @@ partial void ProcessListWebhooksResponseContent( __exception_500 = __ex; } - throw new global::EachLabs.ApiException( + + throw global::EachLabs.ApiException.Create( + statusCode: __response.StatusCode, message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_500, - statusCode: __response.StatusCode) - { - ResponseBody = __content_500, - ResponseObject = __value_500, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_500, + responseObject: __value_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -455,17 +453,15 @@ partial void ProcessListWebhooksResponseContent( } catch (global::System.Exception __ex) { - throw new global::EachLabs.ApiException( + throw global::EachLabs.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 @@ -502,17 +498,15 @@ partial void ProcessListWebhooksResponseContent( { } - throw new global::EachLabs.ApiException( + throw global::EachLabs.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)); } }