From 767dab0403610741b3bf570454d44899f75b90c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 24 May 2026 06:33:36 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../StepFun.AudioClient.CreateSpeech.g.cs | 24 ++-- ...epFun.ChatClient.CreateChatCompletion.g.cs | 24 ++-- .../StepFun/Generated/StepFun.Exceptions.g.cs | 134 ++++++++++++++++++ .../StepFun.ModelsClient.ListModels.g.cs | 24 ++-- .../StepFun.ModelsClient.RetrieveModel.g.cs | 24 ++-- .../StepFun.TokensClient.CountTokens.g.cs | 24 ++-- 6 files changed, 184 insertions(+), 70 deletions(-) diff --git a/src/libs/StepFun/Generated/StepFun.AudioClient.CreateSpeech.g.cs b/src/libs/StepFun/Generated/StepFun.AudioClient.CreateSpeech.g.cs index de40e8e..7ff336c 100644 --- a/src/libs/StepFun/Generated/StepFun.AudioClient.CreateSpeech.g.cs +++ b/src/libs/StepFun/Generated/StepFun.AudioClient.CreateSpeech.g.cs @@ -367,17 +367,15 @@ partial void ProcessCreateSpeechResponseContent( } catch (global::System.Exception __ex) { - throw new global::StepFun.ApiException( + throw global::StepFun.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 @@ -414,17 +412,15 @@ partial void ProcessCreateSpeechResponseContent( { } - throw new global::StepFun.ApiException( + throw global::StepFun.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/StepFun/Generated/StepFun.ChatClient.CreateChatCompletion.g.cs b/src/libs/StepFun/Generated/StepFun.ChatClient.CreateChatCompletion.g.cs index 3b2c742..0d7c71e 100644 --- a/src/libs/StepFun/Generated/StepFun.ChatClient.CreateChatCompletion.g.cs +++ b/src/libs/StepFun/Generated/StepFun.ChatClient.CreateChatCompletion.g.cs @@ -367,17 +367,15 @@ partial void ProcessCreateChatCompletionResponseContent( } catch (global::System.Exception __ex) { - throw new global::StepFun.ApiException( + throw global::StepFun.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 @@ -414,17 +412,15 @@ partial void ProcessCreateChatCompletionResponseContent( { } - throw new global::StepFun.ApiException( + throw global::StepFun.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/StepFun/Generated/StepFun.Exceptions.g.cs b/src/libs/StepFun/Generated/StepFun.Exceptions.g.cs index 43f562f..91d5636 100644 --- a/src/libs/StepFun/Generated/StepFun.Exceptions.g.cs +++ b/src/libs/StepFun/Generated/StepFun.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::StepFun.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::StepFun.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body and headers populated. + /// + public static global::StepFun.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException, + string? responseBody, + global::System.Collections.Generic.Dictionary>? responseHeaders) + { + var exception = global::StepFun.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::StepFun.ApiException Create( + global::System.Net.HttpStatusCode statusCode, + string message, + global::System.Exception? innerException = null, + global::System.Collections.Generic.IDictionary>? responseHeaders = null) + { + return new global::StepFun.ApiException(message, innerException, statusCode); + } + + /// + /// Convenience overload that constructs an with response body, object, and headers populated. + /// + public static global::StepFun.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::StepFun.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/StepFun/Generated/StepFun.ModelsClient.ListModels.g.cs b/src/libs/StepFun/Generated/StepFun.ModelsClient.ListModels.g.cs index 77daadd..3c3209d 100644 --- a/src/libs/StepFun/Generated/StepFun.ModelsClient.ListModels.g.cs +++ b/src/libs/StepFun/Generated/StepFun.ModelsClient.ListModels.g.cs @@ -347,17 +347,15 @@ partial void ProcessListModelsResponseContent( } catch (global::System.Exception __ex) { - throw new global::StepFun.ApiException( + throw global::StepFun.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 @@ -394,17 +392,15 @@ partial void ProcessListModelsResponseContent( { } - throw new global::StepFun.ApiException( + throw global::StepFun.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/StepFun/Generated/StepFun.ModelsClient.RetrieveModel.g.cs b/src/libs/StepFun/Generated/StepFun.ModelsClient.RetrieveModel.g.cs index daeece7..77494ea 100644 --- a/src/libs/StepFun/Generated/StepFun.ModelsClient.RetrieveModel.g.cs +++ b/src/libs/StepFun/Generated/StepFun.ModelsClient.RetrieveModel.g.cs @@ -356,17 +356,15 @@ partial void ProcessRetrieveModelResponseContent( } catch (global::System.Exception __ex) { - throw new global::StepFun.ApiException( + throw global::StepFun.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 @@ -403,17 +401,15 @@ partial void ProcessRetrieveModelResponseContent( { } - throw new global::StepFun.ApiException( + throw global::StepFun.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/StepFun/Generated/StepFun.TokensClient.CountTokens.g.cs b/src/libs/StepFun/Generated/StepFun.TokensClient.CountTokens.g.cs index ff6c1cc..4323e8f 100644 --- a/src/libs/StepFun/Generated/StepFun.TokensClient.CountTokens.g.cs +++ b/src/libs/StepFun/Generated/StepFun.TokensClient.CountTokens.g.cs @@ -367,17 +367,15 @@ partial void ProcessCountTokensResponseContent( } catch (global::System.Exception __ex) { - throw new global::StepFun.ApiException( + throw global::StepFun.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 @@ -414,17 +412,15 @@ partial void ProcessCountTokensResponseContent( { } - throw new global::StepFun.ApiException( + throw global::StepFun.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)); } }