diff --git a/src/libs/FishAudio/Generated/FishAudio.Exceptions.g.cs b/src/libs/FishAudio/Generated/FishAudio.Exceptions.g.cs index a9af519..ba90488 100644 --- a/src/libs/FishAudio/Generated/FishAudio.Exceptions.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.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::FishAudio.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::FishAudio.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::FishAudio.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::FishAudio.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::FishAudio.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::FishAudio.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::FishAudio.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::FishAudio.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/FishAudio/Generated/FishAudio.ModelClient.CreateModel.g.cs b/src/libs/FishAudio/Generated/FishAudio.ModelClient.CreateModel.g.cs index 5ddb0bf..c9a3385 100644 --- a/src/libs/FishAudio/Generated/FishAudio.ModelClient.CreateModel.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.ModelClient.CreateModel.g.cs @@ -360,18 +360,17 @@ partial void ProcessCreateModelResponseContent( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -398,18 +397,17 @@ partial void ProcessCreateModelResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -443,17 +441,15 @@ partial void ProcessCreateModelResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -490,17 +486,15 @@ partial void ProcessCreateModelResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.ModelClient.DeleteModelById.g.cs b/src/libs/FishAudio/Generated/FishAudio.ModelClient.DeleteModelById.g.cs index a1ff246..755f0de 100644 --- a/src/libs/FishAudio/Generated/FishAudio.ModelClient.DeleteModelById.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.ModelClient.DeleteModelById.g.cs @@ -342,18 +342,17 @@ await DeleteModelByIdAsResponseAsync( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -380,18 +379,17 @@ await DeleteModelByIdAsResponseAsync( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -418,17 +416,15 @@ await DeleteModelByIdAsResponseAsync( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -456,17 +452,15 @@ await DeleteModelByIdAsResponseAsync( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.ModelClient.EditModelById.g.cs b/src/libs/FishAudio/Generated/FishAudio.ModelClient.EditModelById.g.cs index d34dade..e99c7c0 100644 --- a/src/libs/FishAudio/Generated/FishAudio.ModelClient.EditModelById.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.ModelClient.EditModelById.g.cs @@ -362,18 +362,17 @@ await EditModelByIdAsResponseAsync( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -400,18 +399,17 @@ await EditModelByIdAsResponseAsync( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -438,17 +436,15 @@ await EditModelByIdAsResponseAsync( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 +472,15 @@ await EditModelByIdAsResponseAsync( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.ModelClient.GetModel.g.cs b/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModel.g.cs index d64ca60..d0c5bcf 100644 --- a/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModel.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModel.g.cs @@ -468,18 +468,17 @@ partial void ProcessGetModelResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -513,17 +512,15 @@ partial void ProcessGetModelResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -560,17 +557,15 @@ partial void ProcessGetModelResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.ModelClient.GetModelById.g.cs b/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModelById.g.cs index 6d005b3..eb5a6b8 100644 --- a/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModelById.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.ModelClient.GetModelById.g.cs @@ -349,18 +349,17 @@ partial void ProcessGetModelByIdResponseContent( __exception_404 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -387,18 +386,17 @@ partial void ProcessGetModelByIdResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -432,17 +430,15 @@ partial void ProcessGetModelByIdResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -479,17 +475,15 @@ partial void ProcessGetModelByIdResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateAsr.g.cs b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateAsr.g.cs index 656a28e..905f4ad 100644 --- a/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateAsr.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateAsr.g.cs @@ -360,18 +360,17 @@ partial void ProcessCreateAsrResponseContent( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // No payment -- see charging schemes if ((int)__response.StatusCode == 402) @@ -398,18 +397,17 @@ partial void ProcessCreateAsrResponseContent( __exception_402 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseObject = __value_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseObject: __value_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 422) @@ -436,18 +434,17 @@ partial void ProcessCreateAsrResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -481,17 +478,15 @@ partial void ProcessCreateAsrResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -528,17 +523,15 @@ partial void ProcessCreateAsrResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTts.g.cs b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTts.g.cs index 8e348e1..7330453 100644 --- a/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTts.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTts.g.cs @@ -427,18 +427,17 @@ await CreateTtsAsResponseAsync( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // No payment -- see charging schemes if ((int)__response.StatusCode == 402) @@ -465,18 +464,17 @@ await CreateTtsAsResponseAsync( __exception_402 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.ApiException.Create( + statusCode: __response.StatusCode, message: __content_402 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_402, - statusCode: __response.StatusCode) - { - ResponseBody = __content_402, - ResponseObject = __value_402, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_402, + responseObject: __value_402, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } // if ((int)__response.StatusCode == 422) @@ -503,18 +501,17 @@ await CreateTtsAsResponseAsync( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -541,17 +538,15 @@ await CreateTtsAsResponseAsync( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -579,17 +574,15 @@ await CreateTtsAsResponseAsync( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTtsStreamWithTimestamp.g.cs b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTtsStreamWithTimestamp.g.cs index b005722..f3b2225 100644 --- a/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTtsStreamWithTimestamp.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.OpenAPIV1Client.CreateTtsStreamWithTimestamp.g.cs @@ -357,17 +357,15 @@ partial void ProcessCreateTtsStreamWithTimestampResponse( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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)); } using var __stream = await __response.Content.ReadAsStreamAsync( @@ -386,16 +384,15 @@ partial void ProcessCreateTtsStreamWithTimestampResponse( } var __streamedResponse = global::FishAudio.CreateTtsStreamWithTimestampResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::FishAudio.ApiException( + throw global::FishAudio.ApiException.Create( + statusCode: __response.StatusCode, message: $"Response deserialization failed for \"{__content}\" ", - statusCode: __response.StatusCode) - { - ResponseBody = __content, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + innerException: null, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); yield return __streamedResponse; } diff --git a/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdApiCredit.g.cs b/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdApiCredit.g.cs index fcfed18..b8cb4fa 100644 --- a/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdApiCredit.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdApiCredit.g.cs @@ -383,18 +383,17 @@ partial void ProcessGetWalletByUserIdApiCreditResponseContent( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -421,18 +420,17 @@ partial void ProcessGetWalletByUserIdApiCreditResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -466,17 +464,15 @@ partial void ProcessGetWalletByUserIdApiCreditResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -513,17 +509,15 @@ partial void ProcessGetWalletByUserIdApiCreditResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdPackage.g.cs b/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdPackage.g.cs index 88dface..984bf34 100644 --- a/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdPackage.g.cs +++ b/src/libs/FishAudio/Generated/FishAudio.WalletClient.GetWalletByUserIdPackage.g.cs @@ -353,18 +353,17 @@ partial void ProcessGetWalletByUserIdPackageResponseContent( __exception_401 = __ex; } - throw new global::FishAudio.ApiException( + + throw global::FishAudio.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)); } // if ((int)__response.StatusCode == 422) @@ -391,18 +390,17 @@ partial void ProcessGetWalletByUserIdPackageResponseContent( __exception_422 = __ex; } - throw new global::FishAudio.ApiException>( + + throw global::FishAudio.ApiException>.Create( + statusCode: __response.StatusCode, message: __content_422 ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_422, - statusCode: __response.StatusCode) - { - ResponseBody = __content_422, - ResponseObject = __value_422, - ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + responseBody: __content_422, + responseObject: __value_422, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, - h => h.Value), - }; + h => h.Value)); } if (__effectiveReadResponseAsString) @@ -436,17 +434,15 @@ partial void ProcessGetWalletByUserIdPackageResponseContent( } catch (global::System.Exception __ex) { - throw new global::FishAudio.ApiException( + throw global::FishAudio.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 @@ -483,17 +479,15 @@ partial void ProcessGetWalletByUserIdPackageResponseContent( { } - throw new global::FishAudio.ApiException( + throw global::FishAudio.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)); } }