diff --git a/src/libs/Nixtla/Generated/Nixtla.AutoSDKHttpResponse.g.cs b/src/libs/Nixtla/Generated/Nixtla.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..d92a434 --- /dev/null +++ b/src/libs/Nixtla/Generated/Nixtla.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace Nixtla +{ + /// + /// Represents a successful HTTP response with status code and headers. + /// + public partial class AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri) + { + StatusCode = statusCode; + Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers)); + RequestUri = requestUri; + } + + /// + /// Gets the HTTP status code. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// Gets the response headers. + /// + public global::System.Collections.Generic.Dictionary> Headers { get; } + /// + /// Gets the final request URI associated with the response. + /// + public global::System.Uri? RequestUri { get; } + + internal static global::System.Collections.Generic.Dictionary> CreateHeaders( + global::System.Net.Http.HttpResponseMessage response) + { + response = response ?? throw new global::System.ArgumentNullException(nameof(response)); + + var headers = global::System.Linq.Enumerable.ToDictionary( + response.Headers, + static header => header.Key, + static header => (global::System.Collections.Generic.IEnumerable)global::System.Linq.Enumerable.ToArray(header.Value), + global::System.StringComparer.OrdinalIgnoreCase); + + if (response.Content?.Headers == null) + { + return headers; + } + + foreach (var header in response.Content.Headers) + { + if (headers.TryGetValue(header.Key, out var existingValues)) + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray( + global::System.Linq.Enumerable.Concat(existingValues, header.Value)); + } + else + { + headers[header.Key] = global::System.Linq.Enumerable.ToArray(header.Value); + } + } + + return headers; + } + } + + /// + /// Represents a successful HTTP response with status code, headers, and body. + /// + public partial class AutoSDKHttpResponse : AutoSDKHttpResponse + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + T body) + : this( + statusCode: statusCode, + headers: headers, + requestUri: null, + body: body) + { + } + + /// + /// Initializes a new instance of the class. + /// + public AutoSDKHttpResponse( + global::System.Net.HttpStatusCode statusCode, + global::System.Collections.Generic.Dictionary> headers, + global::System.Uri? requestUri, + T body) + : base(statusCode, headers, requestUri) + { + Body = body; + } + + /// + /// Gets the response body. + /// + public T Body { get; } + } +} \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.GetModelParamsModelParamsGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.GetModelParamsModelParamsGet.g.cs index 30ea58f..0a2e7bc 100644 --- a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.GetModelParamsModelParamsGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.GetModelParamsModelParamsGet.g.cs @@ -56,6 +56,29 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( string freq, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetModelParamsModelParamsGetAsResponseAsync( + model: model, + freq: freq, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get Model Params + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetModelParamsModelParamsGetAsResponseAsync( + object model, + string freq, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,12 +109,13 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/model_params", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("model", model.ToString()!) - .AddRequiredParameter("freq", freq) + .AddRequiredParameter("freq", freq) ; var __path = __pathBuilder.ToString(); __path = global::Nixtla.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -164,6 +188,8 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,7 +397,11 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -383,7 +429,11 @@ partial void ProcessGetModelParamsModelParamsGetResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.HealthHealthGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.HealthHealthGet.g.cs index 3aaa794..fcb7329 100644 --- a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.HealthHealthGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.HealthHealthGet.g.cs @@ -50,6 +50,25 @@ partial void ProcessHealthHealthGetResponseContent( public async global::System.Threading.Tasks.Task HealthHealthGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await HealthHealthGetAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Health
+ /// Check if server is healthy.
+ /// Used by the readiness probe to check server is healthy. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> HealthHealthGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -78,6 +97,7 @@ partial void ProcessHealthHealthGetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/health", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessHealthHealthGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessHealthHealthGetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessHealthHealthGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessHealthHealthGetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessHealthHealthGetResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessHealthHealthGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessHealthHealthGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessHealthHealthGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -303,7 +341,11 @@ partial void ProcessHealthHealthGetResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -331,7 +373,11 @@ partial void ProcessHealthHealthGetResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.ModelParams.g.cs b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.ModelParams.g.cs index bf61d0d..9434b8a 100644 --- a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.ModelParams.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.ModelParams.g.cs @@ -52,6 +52,28 @@ partial void ProcessModelParamsResponseContent( /// public async global::System.Threading.Tasks.Task ModelParamsAsync( + global::Nixtla.SingleSeriesForecast request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModelParamsAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Model Params + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ModelParamsAsResponseAsync( + global::Nixtla.SingleSeriesForecast request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -86,6 +108,7 @@ partial void ProcessModelParamsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/model_params", baseUri: HttpClient.BaseAddress); @@ -165,6 +188,8 @@ partial void ProcessModelParamsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +200,11 @@ partial void ProcessModelParamsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -192,6 +222,8 @@ partial void ProcessModelParamsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +233,7 @@ partial void ProcessModelParamsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +242,11 @@ partial void ProcessModelParamsResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -227,14 +263,15 @@ partial void ProcessModelParamsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -274,6 +311,8 @@ partial void ProcessModelParamsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +333,8 @@ partial void ProcessModelParamsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -356,7 +397,11 @@ partial void ProcessModelParamsResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -384,7 +429,11 @@ partial void ProcessModelParamsResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.g.cs b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.g.cs index e7155f7..1509337 100644 --- a/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.ExcludedClient.g.cs @@ -72,10 +72,10 @@ public ExcludedClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ExcludedClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Nixtla.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Nixtla.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.GetModelParamsModelParamsGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.GetModelParamsModelParamsGet.g.cs index 03a8a81..130a950 100644 --- a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.GetModelParamsModelParamsGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.GetModelParamsModelParamsGet.g.cs @@ -17,5 +17,18 @@ public partial interface IExcludedClient string freq, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get Model Params + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetModelParamsModelParamsGetAsResponseAsync( + object model, + string freq, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.HealthHealthGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.HealthHealthGet.g.cs index 3080305..2fd0fd0 100644 --- a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.HealthHealthGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.HealthHealthGet.g.cs @@ -15,5 +15,16 @@ public partial interface IExcludedClient global::System.Threading.Tasks.Task HealthHealthGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Health
+ /// Check if server is healthy.
+ /// Used by the readiness probe to check server is healthy. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> HealthHealthGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.ModelParams.g.cs b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.ModelParams.g.cs index 52631f8..e06c3f2 100644 --- a/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.ModelParams.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.IExcludedClient.ModelParams.g.cs @@ -21,6 +21,18 @@ public partial interface IExcludedClient /// /// Model Params /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModelParamsAsResponseAsync( + + global::Nixtla.SingleSeriesForecast request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Model Params + /// /// /// Model to use as a string. Common options are (but not restricted to) `timegpt-1` and `timegpt-1-long-horizon.` Full options vary by different users. Contact support@nixtla.io for more information. We recommend using `timegpt-1-long-horizon` for forecasting if you want to predict more than one seasonal period given the frequency of your data.
/// Default Value: timegpt-1 diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2AnomalyDetection.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2AnomalyDetection.g.cs index 55492af..5d857e5 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2AnomalyDetection.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2AnomalyDetection.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Multi Series Anomaly Detector
/// Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2AnomalyDetectionAsResponseAsync( + + global::Nixtla.AnomalyDetectionInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Multi Series Anomaly Detector
+ /// Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2CrossValidation.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2CrossValidation.g.cs index 4329f8d..fe73584 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2CrossValidation.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2CrossValidation.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Multi Series Cross Validation
/// Perform Cross Validation for multiple series /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2CrossValidationAsResponseAsync( + + global::Nixtla.CrossValidationInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Multi Series Cross Validation
+ /// Perform Cross Validation for multiple series + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Finetune.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Finetune.g.cs index 691e279..a58216d 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Finetune.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Finetune.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Multi Series Finetuning
/// Fine-tune the large time model to your data and save it for later use. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the ID of the finetuned model, which you can provide in other endpoints to use that model to make the forecasts. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2FinetuneAsResponseAsync( + + global::Nixtla.FinetuneInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Multi Series Finetuning
+ /// Fine-tune the large time model to your data and save it for later use. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the ID of the finetuned model, which you can provide in other endpoints to use that model to make the forecasts. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs index 206ec0b..f620a92 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs @@ -16,5 +16,17 @@ public partial interface INixtlaClient string finetunedModelId, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get single Fine-tuned Model
+ /// Retrieve metadata for a previously fine-tuned model. The response contains the metadata of a model that you have fine-tuned and is available to make forecasts. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2FinetunedModelV2FinetunedModelsFinetunedModelIdGetAsResponseAsync( + string finetunedModelId, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs index f91de93..c64f555 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs @@ -16,5 +16,17 @@ public partial interface INixtlaClient string finetunedModelId, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete Fine-tuned Model
+ /// Delete a previously saved finetuned model. It takes the ID of the model that you want to delete as a path parameter. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDeleteAsResponseAsync( + string finetunedModelId, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs index 946aa70..a1ffd9d 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs @@ -14,5 +14,15 @@ public partial interface INixtlaClient global::System.Threading.Tasks.Task V2FinetunedModelsV2FinetunedModelsGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Fine-tuned Models
+ /// List all the finetuned models that you have created. The response contains a list with the IDs of the models that you have fine-tuned and are available to make forecasts. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2FinetunedModelsV2FinetunedModelsGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Forecast.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Forecast.g.cs index adca2a3..1f0efd8 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Forecast.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2Forecast.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Multi Series
/// Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2ForecastAsResponseAsync( + + global::Nixtla.ForecastInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Multi Series
+ /// Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2HistoricForecast.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2HistoricForecast.g.cs index 77f9189..4d95a8b 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2HistoricForecast.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2HistoricForecast.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Multi Series Historic
/// Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2HistoricForecastAsResponseAsync( + + global::Nixtla.InSampleInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Multi Series Historic
+ /// Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2OnlineAnomalyDetection.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2OnlineAnomalyDetection.g.cs index bc71731..9ca60b3 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2OnlineAnomalyDetection.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.V2OnlineAnomalyDetection.g.cs @@ -21,6 +21,19 @@ public partial interface INixtlaClient /// Foundational Time Series Model Online Multi Series Anomaly Detector
/// This endpoint performs online anomaly detection based on the provided data. It uses cross-validation for more robust detection of anomalies and it supports detection for univariate and multivariate scenarios. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly, it provides the prediction interval used to define if an observation is an anomaly, and it reports the associated z-score for each point. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> V2OnlineAnomalyDetectionAsResponseAsync( + + global::Nixtla.OnlineAnomalyInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Foundational Time Series Model Online Multi Series Anomaly Detector
+ /// This endpoint performs online anomaly detection based on the provided data. It uses cross-validation for more robust detection of anomalies and it supports detection for univariate and multivariate scenarios. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly, it provides the prediction interval used to define if an observation is an anomaly, and it reports the associated z-score for each point. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
/// /// /// The frequency of the data represented as a string. 'D' for daily, 'M' for monthly, 'H' for hourly, and 'W' for weekly frequencies are available. diff --git a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs index 8ad5ce9..c3741d3 100644 --- a/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.INixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs @@ -13,5 +13,14 @@ public partial interface INixtlaClient global::System.Threading.Tasks.Task ValidateApiKeyValidateApiKeyGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Validate Api Key + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ValidateApiKeyValidateApiKeyGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2AnomalyDetection.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2AnomalyDetection.g.cs index faf039d..d30cd4a 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2AnomalyDetection.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2AnomalyDetection.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2AnomalyDetectionResponseContent( /// public async global::System.Threading.Tasks.Task V2AnomalyDetectionAsync( + global::Nixtla.AnomalyDetectionInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2AnomalyDetectionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Multi Series Anomaly Detector
+ /// Based on the provided data, this endpoint detects the anomalies in the historical perdiod of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly and also provides the prediction interval used to define if an observation is an anomaly.Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2AnomalyDetectionAsResponseAsync( + global::Nixtla.AnomalyDetectionInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2AnomalyDetectionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/anomaly_detection", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2AnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2AnomalyDetectionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2AnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2AnomalyDetectionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2AnomalyDetectionResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2AnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2AnomalyDetectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2AnomalyDetectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2AnomalyDetectionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.AnomalyDetectionOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.AnomalyDetectionOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2AnomalyDetectionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.AnomalyDetectionOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.AnomalyDetectionOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2CrossValidation.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2CrossValidation.g.cs index a493742..0045832 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2CrossValidation.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2CrossValidation.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2CrossValidationResponseContent( /// public async global::System.Threading.Tasks.Task V2CrossValidationAsync( + global::Nixtla.CrossValidationInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2CrossValidationAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Multi Series Cross Validation
+ /// Perform Cross Validation for multiple series + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2CrossValidationAsResponseAsync( + global::Nixtla.CrossValidationInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2CrossValidationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/cross_validation", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2CrossValidationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2CrossValidationResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2CrossValidationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2CrossValidationResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2CrossValidationResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2CrossValidationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2CrossValidationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2CrossValidationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2CrossValidationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.CrossValidationOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.CrossValidationOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2CrossValidationResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.CrossValidationOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.CrossValidationOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Finetune.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Finetune.g.cs index 5a1b0d8..af5df37 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Finetune.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Finetune.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2FinetuneResponseContent( /// public async global::System.Threading.Tasks.Task V2FinetuneAsync( + global::Nixtla.FinetuneInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2FinetuneAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Multi Series Finetuning
+ /// Fine-tune the large time model to your data and save it for later use. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the ID of the finetuned model, which you can provide in other endpoints to use that model to make the forecasts. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2FinetuneAsResponseAsync( + global::Nixtla.FinetuneInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2FinetuneResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/finetune", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2FinetuneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2FinetuneResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2FinetuneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2FinetuneResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2FinetuneResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2FinetuneResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2FinetuneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2FinetuneResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2FinetuneResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.FinetuneOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.FinetuneOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2FinetuneResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.FinetuneOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.FinetuneOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs index 36be217..b6d157d 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelV2FinetunedModelsFinetunedModelIdGet.g.cs @@ -53,6 +53,27 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse string finetunedModelId, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2FinetunedModelV2FinetunedModelsFinetunedModelIdGetAsResponseAsync( + finetunedModelId: finetunedModelId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get single Fine-tuned Model
+ /// Retrieve metadata for a previously fine-tuned model. The response contains the metadata of a model that you have fine-tuned and is available to make forecasts. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2FinetunedModelV2FinetunedModelsFinetunedModelIdGetAsResponseAsync( + string finetunedModelId, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: $"/v2/finetuned_models/{finetunedModelId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -191,8 +222,7 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -346,9 +386,13 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.FinetunedModel.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.FinetunedModel.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -376,9 +420,13 @@ partial void ProcessV2FinetunedModelV2FinetunedModelsFinetunedModelIdGetResponse #endif ).ConfigureAwait(false); - return - await global::Nixtla.FinetunedModel.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.FinetunedModel.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs index 6b199d3..f2a3b8b 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDelete.g.cs @@ -48,6 +48,25 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele string finetunedModelId, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDeleteAsResponseAsync( + finetunedModelId: finetunedModelId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete Fine-tuned Model
+ /// Delete a previously saved finetuned model. It takes the ID of the model that you want to delete as a path parameter. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task V2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDeleteAsResponseAsync( + string finetunedModelId, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: $"/v2/finetuned_models/{finetunedModelId}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -177,6 +204,8 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -212,14 +245,15 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -259,6 +293,8 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -337,6 +375,10 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele { __response.EnsureSuccessStatusCode(); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -358,6 +400,10 @@ partial void ProcessV2FinetunedModelsDeleteV2FinetunedModelsFinetunedModelIdDele try { __response.EnsureSuccessStatusCode(); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs index 70d02de..5db13c2 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2FinetunedModelsV2FinetunedModelsGet.g.cs @@ -49,6 +49,24 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( public async global::System.Threading.Tasks.Task V2FinetunedModelsV2FinetunedModelsGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2FinetunedModelsV2FinetunedModelsGetAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Fine-tuned Models
+ /// List all the finetuned models that you have created. The response contains a list with the IDs of the models that you have fine-tuned and are available to make forecasts. + ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2FinetunedModelsV2FinetunedModelsGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +95,7 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/finetuned_models", baseUri: HttpClient.BaseAddress); @@ -149,6 +168,8 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -159,6 +180,11 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -176,6 +202,8 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -185,8 +213,7 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -195,6 +222,11 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -211,14 +243,15 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -258,6 +291,8 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -278,6 +313,8 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -302,9 +339,13 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.FinetunedModelsOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.FinetunedModelsOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -332,9 +373,13 @@ partial void ProcessV2FinetunedModelsV2FinetunedModelsGetResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.FinetunedModelsOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.FinetunedModelsOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Forecast.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Forecast.g.cs index c580eef..4871c9a 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Forecast.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2Forecast.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2ForecastResponseContent( /// public async global::System.Threading.Tasks.Task V2ForecastAsync( + global::Nixtla.ForecastInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2ForecastAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Multi Series
+ /// Based on the provided data, this endpoint predicts the future values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for each series based on the input arguments. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2ForecastAsResponseAsync( + global::Nixtla.ForecastInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2ForecastResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/forecast", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2ForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2ForecastResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2ForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2ForecastResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2ForecastResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2ForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2ForecastResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2ForecastResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2ForecastResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.ForecastOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.ForecastOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2ForecastResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.ForecastOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.ForecastOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2HistoricForecast.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2HistoricForecast.g.cs index 55c4a43..258c6d3 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2HistoricForecast.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2HistoricForecast.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2HistoricForecastResponseContent( /// public async global::System.Threading.Tasks.Task V2HistoricForecastAsync( + global::Nixtla.InSampleInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2HistoricForecastAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Multi Series Historic
+ /// Based on the provided data, this endpoint predicts the in-sample period (historical period) values of multiple time series at once. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains the predicted values for the historical period. Usually useful for anomaly detection. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2HistoricForecastAsResponseAsync( + global::Nixtla.InSampleInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2HistoricForecastResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/historic_forecast", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2HistoricForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2HistoricForecastResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2HistoricForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2HistoricForecastResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2HistoricForecastResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2HistoricForecastResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2HistoricForecastResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2HistoricForecastResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2HistoricForecastResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.InSampleOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.InSampleOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2HistoricForecastResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.InSampleOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.InSampleOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2OnlineAnomalyDetection.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2OnlineAnomalyDetection.g.cs index f28a42d..4a1474b 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2OnlineAnomalyDetection.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.V2OnlineAnomalyDetection.g.cs @@ -51,6 +51,29 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( /// public async global::System.Threading.Tasks.Task V2OnlineAnomalyDetectionAsync( + global::Nixtla.OnlineAnomalyInput request, + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await V2OnlineAnomalyDetectionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Foundational Time Series Model Online Multi Series Anomaly Detector
+ /// This endpoint performs online anomaly detection based on the provided data. It uses cross-validation for more robust detection of anomalies and it supports detection for univariate and multivariate scenarios. It takes a JSON as an input containing information like the series frequency and historical data. (See below for a full description of the parameters.) The response contains a flag indicating if the date has an anomaly, it provides the prediction interval used to define if an observation is an anomaly, and it reports the associated z-score for each point. Get your token for private beta at https://nixtla.io/free-trial?utm_source=nixtla.io&utm_campaign=/docs/api-reference. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> V2OnlineAnomalyDetectionAsResponseAsync( + global::Nixtla.OnlineAnomalyInput request, global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/v2/online_anomaly_detection", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -191,6 +222,8 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +233,7 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +242,11 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -226,14 +263,15 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -273,6 +311,8 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Validation Error @@ -355,9 +397,13 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::Nixtla.OnlineAnomalyOutput.FromJson(__content, JsonSerializerContext) ?? + var __value = global::Nixtla.OnlineAnomalyOutput.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -385,9 +431,13 @@ partial void ProcessV2OnlineAnomalyDetectionResponseContent( #endif ).ConfigureAwait(false); - return - await global::Nixtla.OnlineAnomalyOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::Nixtla.OnlineAnomalyOutput.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs index 6ea67e7..f6175bd 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.ValidateApiKeyValidateApiKeyGet.g.cs @@ -48,6 +48,23 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( public async global::System.Threading.Tasks.Task ValidateApiKeyValidateApiKeyGetAsync( global::Nixtla.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ValidateApiKeyValidateApiKeyGetAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Validate Api Key + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ValidateApiKeyValidateApiKeyGetAsResponseAsync( + global::Nixtla.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::Nixtla.PathBuilder( path: "/validate_api_key", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -175,6 +200,8 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( __attempt < __maxAttempts && global::Nixtla.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::Nixtla.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::Nixtla.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::Nixtla.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -210,14 +241,15 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); __response.Dispose(); __response = null; __httpRequest.Dispose(); __httpRequest = null; await global::Nixtla.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -257,6 +289,8 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -301,7 +337,11 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -329,7 +369,11 @@ partial void ProcessValidateApiKeyValidateApiKeyGetResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::Nixtla.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Nixtla.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.g.cs b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.g.cs index 81dd6cc..d09830d 100644 --- a/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.NixtlaClient.g.cs @@ -43,7 +43,7 @@ public sealed partial class NixtlaClient : global::Nixtla.INixtlaClient, global: /// /// /// - public ExcludedClient Excluded => new ExcludedClient(HttpClient, authorizations: Authorizations, options: Options) + public ExcludedClient Excluded => new ExcludedClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -82,10 +82,10 @@ public NixtlaClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public NixtlaClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::Nixtla.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Nixtla.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/Nixtla/Generated/Nixtla.OptionsSupport.g.cs b/src/libs/Nixtla/Generated/Nixtla.OptionsSupport.g.cs index 34b9ac6..1638aff 100644 --- a/src/libs/Nixtla/Generated/Nixtla.OptionsSupport.g.cs +++ b/src/libs/Nixtla/Generated/Nixtla.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::Nixtla.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::Nixtla.AutoSDKClientOptions clientOptions, global::Nixtla.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::Nixtla.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::Nixtla.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode(