diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs index a2c77f4..849f226 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.GetModel.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetModelResponseContent( string slug, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetModelAsResponseAsync( + slug: slug, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get model details
+ /// Retrieve detailed information about a specific model by slug + ///
+ /// + /// 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> GetModelAsResponseAsync( + string slug, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,11 +103,12 @@ partial void ProcessGetModelResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: "/v1/model", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddRequiredParameter("slug", slug) + .AddRequiredParameter("slug", slug) ; var __path = __pathBuilder.ToString(); __path = global::EachLabs.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -158,6 +180,8 @@ partial void ProcessGetModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -168,6 +192,11 @@ partial void ProcessGetModelResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -185,6 +214,8 @@ partial void ProcessGetModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -194,8 +225,7 @@ partial void ProcessGetModelResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -204,6 +234,11 @@ partial void ProcessGetModelResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -220,14 +255,15 @@ partial void ProcessGetModelResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -267,6 +303,8 @@ partial void ProcessGetModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -287,6 +325,8 @@ partial void ProcessGetModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -425,9 +465,13 @@ partial void ProcessGetModelResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::EachLabs.ModelDetail.FromJson(__content, JsonSerializerContext) ?? + var __value = global::EachLabs.ModelDetail.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -455,9 +499,13 @@ partial void ProcessGetModelResponseContent( #endif ).ConfigureAwait(false); - return - await global::EachLabs.ModelDetail.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::EachLabs.ModelDetail.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs index 1efbad0..97f0c72 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.ListModels.g.cs @@ -65,6 +65,37 @@ partial void ProcessListModelsResponseContent( int? offset = default, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListModelsAsResponseAsync( + name: name, + limit: limit, + offset: offset, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List AI models
+ /// Retrieve a paginated list of AI models with optional filters + ///
+ /// + /// + /// Default Value: 50 + /// + /// + /// Default Value: 0 + /// + /// 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>> ListModelsAsResponseAsync( + string? name = default, + int? limit = default, + int? offset = default, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +127,14 @@ partial void ProcessListModelsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: "/v1/models", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("name", name) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("offset", offset?.ToString()) + .AddOptionalParameter("offset", offset?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::EachLabs.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -176,6 +208,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -186,6 +220,11 @@ partial void ProcessListModelsResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -203,6 +242,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -212,8 +253,7 @@ partial void ProcessListModelsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -222,6 +262,11 @@ partial void ProcessListModelsResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -238,14 +283,15 @@ partial void ProcessListModelsResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -285,6 +331,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -305,6 +353,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -405,9 +455,13 @@ partial void ProcessListModelsResponseContent( { __response.EnsureSuccessStatusCode(); - return - (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? + var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -435,9 +489,13 @@ partial void ProcessListModelsResponseContent( #endif ).ConfigureAwait(false); - return - (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? + var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse>( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.g.cs index 9f4e68e..56bb215 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsClient.g.cs @@ -73,10 +73,10 @@ public AiModelsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AiModelsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::EachLabs.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::EachLabs.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs index 71cc0fe..6195513 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.CreatePrediction.g.cs @@ -53,6 +53,29 @@ partial void ProcessCreatePredictionResponseContent( /// public async global::System.Threading.Tasks.Task CreatePredictionAsync( + global::EachLabs.CreatePredictionRequest request, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreatePredictionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create Model Prediction
+ /// Create a new prediction for a specific model + ///
+ /// + /// 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> CreatePredictionAsResponseAsync( + global::EachLabs.CreatePredictionRequest request, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -87,6 +110,7 @@ partial void ProcessCreatePredictionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: "/v1/prediction", baseUri: HttpClient.BaseAddress); @@ -166,6 +190,8 @@ partial void ProcessCreatePredictionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +202,11 @@ partial void ProcessCreatePredictionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -193,6 +224,8 @@ partial void ProcessCreatePredictionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +235,7 @@ partial void ProcessCreatePredictionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +244,11 @@ partial void ProcessCreatePredictionResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -228,14 +265,15 @@ partial void ProcessCreatePredictionResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -275,6 +313,8 @@ partial void ProcessCreatePredictionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +335,8 @@ partial void ProcessCreatePredictionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -395,9 +437,13 @@ partial void ProcessCreatePredictionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::EachLabs.CreatePredictionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::EachLabs.CreatePredictionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -425,9 +471,13 @@ partial void ProcessCreatePredictionResponseContent( #endif ).ConfigureAwait(false); - return - await global::EachLabs.CreatePredictionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::EachLabs.CreatePredictionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs index 0c71ee3..4954418 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.GetPrediction.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetPredictionResponseContent( string id, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetPredictionAsResponseAsync( + id: id, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get Model Prediction
+ /// Retrieve the status and results of a model prediction by its ID + ///
+ /// + /// 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> GetPredictionAsResponseAsync( + string id, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetPredictionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: $"/v1/prediction/{id}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetPredictionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetPredictionResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetPredictionResponseContent( 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 ProcessGetPredictionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetPredictionResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetPredictionResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetPredictionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetPredictionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Prediction not found @@ -384,9 +424,13 @@ partial void ProcessGetPredictionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::EachLabs.Prediction.FromJson(__content, JsonSerializerContext) ?? + var __value = global::EachLabs.Prediction.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -414,9 +458,13 @@ partial void ProcessGetPredictionResponseContent( #endif ).ConfigureAwait(false); - return - await global::EachLabs.Prediction.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::EachLabs.Prediction.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.g.cs b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.g.cs index ec0e96c..e2c4243 100644 --- a/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.AiModelsPredictionClient.g.cs @@ -73,10 +73,10 @@ public AiModelsPredictionClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public AiModelsPredictionClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::EachLabs.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::EachLabs.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/EachLabs/Generated/EachLabs.AutoSDKHttpResponse.g.cs b/src/libs/EachLabs/Generated/EachLabs.AutoSDKHttpResponse.g.cs new file mode 100644 index 0000000..b1565ed --- /dev/null +++ b/src/libs/EachLabs/Generated/EachLabs.AutoSDKHttpResponse.g.cs @@ -0,0 +1,121 @@ + +#nullable enable + +namespace EachLabs +{ + /// + /// 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/EachLabs/Generated/EachLabs.EachLabsClient.g.cs b/src/libs/EachLabs/Generated/EachLabs.EachLabsClient.g.cs index d0766d5..4f4bf9b 100644 --- a/src/libs/EachLabs/Generated/EachLabs.EachLabsClient.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.EachLabsClient.g.cs @@ -44,7 +44,7 @@ public sealed partial class EachLabsClient : global::EachLabs.IEachLabsClient, g /// /// Endpoints for listing and retrieving AI models and other resources. /// - public AiModelsClient AiModels => new AiModelsClient(HttpClient, authorizations: Authorizations, options: Options) + public AiModelsClient AiModels => new AiModelsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -53,7 +53,7 @@ public sealed partial class EachLabsClient : global::EachLabs.IEachLabsClient, g /// /// Endpoints for managing model predictions. /// - public AiModelsPredictionClient AiModelsPrediction => new AiModelsPredictionClient(HttpClient, authorizations: Authorizations, options: Options) + public AiModelsPredictionClient AiModelsPrediction => new AiModelsPredictionClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -63,7 +63,7 @@ public sealed partial class EachLabsClient : global::EachLabs.IEachLabsClient, g /// Endpoints for retrieving webhook information and delivery history.
/// **Note:** Currently, webhooks are only supported for Workflows V2. We are actively expanding webhook support to other services and will update this documentation as new integrations become available. /// - public WebhooksClient Webhooks => new WebhooksClient(HttpClient, authorizations: Authorizations, options: Options) + public WebhooksClient Webhooks => new WebhooksClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -102,10 +102,10 @@ public EachLabsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public EachLabsClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::EachLabs.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::EachLabs.AutoSDKClientOptions? options, bool disposeHttpClient = true) { diff --git a/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.GetModel.g.cs b/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.GetModel.g.cs index 06de4c0..9351858 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.GetModel.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.GetModel.g.cs @@ -16,5 +16,17 @@ public partial interface IAiModelsClient string slug, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get model details
+ /// Retrieve detailed information about a specific model by slug + ///
+ /// + /// 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> GetModelAsResponseAsync( + string slug, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.ListModels.g.cs b/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.ListModels.g.cs index c0c7237..a66d325 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.ListModels.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IAiModelsClient.ListModels.g.cs @@ -24,5 +24,25 @@ public partial interface IAiModelsClient int? offset = default, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List AI models
+ /// Retrieve a paginated list of AI models with optional filters + ///
+ /// + /// + /// Default Value: 50 + /// + /// + /// Default Value: 0 + /// + /// 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>> ListModelsAsResponseAsync( + string? name = default, + int? limit = default, + int? offset = default, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.CreatePrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.CreatePrediction.g.cs index d3d5267..a20de4f 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.CreatePrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.CreatePrediction.g.cs @@ -23,6 +23,19 @@ public partial interface IAiModelsPredictionClient /// Create Model Prediction
/// Create a new prediction for a specific model /// + /// + /// 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> CreatePredictionAsResponseAsync( + + global::EachLabs.CreatePredictionRequest request, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create Model Prediction
+ /// Create a new prediction for a specific model + ///
/// /// Model slug or identifier
/// Example: flux-1-1-pro diff --git a/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.GetPrediction.g.cs b/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.GetPrediction.g.cs index d46612b..efcaae5 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.GetPrediction.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IAiModelsPredictionClient.GetPrediction.g.cs @@ -16,5 +16,17 @@ public partial interface IAiModelsPredictionClient string id, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get Model Prediction
+ /// Retrieve the status and results of a model prediction by its ID + ///
+ /// + /// 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> GetPredictionAsResponseAsync( + string id, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.GetWebhook.g.cs b/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.GetWebhook.g.cs index a783b5b..d1f6d80 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.GetWebhook.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.GetWebhook.g.cs @@ -16,5 +16,17 @@ public partial interface IWebhooksClient string executionId, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get webhook by execution ID
+ /// Retrieve details of a specific webhook including delivery attempts by execution ID + ///
+ /// + /// 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> GetWebhookAsResponseAsync( + string executionId, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.ListWebhooks.g.cs b/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.ListWebhooks.g.cs index ce8f7ab..c55c717 100644 --- a/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.ListWebhooks.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.IWebhooksClient.ListWebhooks.g.cs @@ -22,5 +22,23 @@ public partial interface IWebhooksClient int? offset = default, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List webhooks
+ /// Retrieve a paginated list of webhooks for the authenticated organization + ///
+ /// + /// Default Value: 50 + /// + /// + /// Default Value: 0 + /// + /// 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> ListWebhooksAsResponseAsync( + int? limit = default, + int? offset = default, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/EachLabs/Generated/EachLabs.OptionsSupport.g.cs b/src/libs/EachLabs/Generated/EachLabs.OptionsSupport.g.cs index 44ba247..793c65d 100644 --- a/src/libs/EachLabs/Generated/EachLabs.OptionsSupport.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.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::EachLabs.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::EachLabs.AutoSDKClientOptions clientOptions, global::EachLabs.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::EachLabs.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::EachLabs.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( diff --git a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs index 20b4b12..c39a58c 100644 --- a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.GetWebhook.g.cs @@ -53,6 +53,27 @@ partial void ProcessGetWebhookResponseContent( string executionId, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetWebhookAsResponseAsync( + executionId: executionId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get webhook by execution ID
+ /// Retrieve details of a specific webhook including delivery attempts by execution ID + ///
+ /// + /// 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> GetWebhookAsResponseAsync( + string executionId, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessGetWebhookResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: $"/v1/webhooks/{executionId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessGetWebhookResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessGetWebhookResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -182,6 +211,8 @@ partial void ProcessGetWebhookResponseContent( 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 ProcessGetWebhookResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -201,6 +231,11 @@ partial void ProcessGetWebhookResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -217,14 +252,15 @@ partial void ProcessGetWebhookResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -264,6 +300,8 @@ partial void ProcessGetWebhookResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessGetWebhookResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request @@ -422,9 +462,13 @@ partial void ProcessGetWebhookResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::EachLabs.WebhookWithAttempts.FromJson(__content, JsonSerializerContext) ?? + var __value = global::EachLabs.WebhookWithAttempts.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -452,9 +496,13 @@ partial void ProcessGetWebhookResponseContent( #endif ).ConfigureAwait(false); - return - await global::EachLabs.WebhookWithAttempts.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::EachLabs.WebhookWithAttempts.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs index 8eb080a..0a3cf74 100644 --- a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.ListWebhooks.g.cs @@ -61,6 +61,34 @@ partial void ProcessListWebhooksResponseContent( int? offset = default, global::EachLabs.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListWebhooksAsResponseAsync( + limit: limit, + offset: offset, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List webhooks
+ /// Retrieve a paginated list of webhooks for the authenticated organization + ///
+ /// + /// Default Value: 50 + /// + /// + /// Default Value: 0 + /// + /// 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> ListWebhooksAsResponseAsync( + int? limit = default, + int? offset = default, + global::EachLabs.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,12 +119,13 @@ partial void ProcessListWebhooksResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::EachLabs.PathBuilder( path: "/v1/webhooks", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("offset", offset?.ToString()) + .AddOptionalParameter("offset", offset?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::EachLabs.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -169,6 +198,8 @@ partial void ProcessListWebhooksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +210,11 @@ partial void ProcessListWebhooksResponseContent( } catch (global::System.Net.Http.HttpRequestException __exception) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, @@ -196,6 +232,8 @@ partial void ProcessListWebhooksResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -205,8 +243,7 @@ partial void ProcessListWebhooksResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -215,6 +252,11 @@ partial void ProcessListWebhooksResponseContent( __attempt < __maxAttempts && global::EachLabs.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) { + var __retryDelay = global::EachLabs.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); await global::EachLabs.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( clientOptions: Options, context: global::EachLabs.AutoSDKRequestOptionsSupport.CreateHookContext( @@ -231,14 +273,15 @@ partial void ProcessListWebhooksResponseContent( 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::EachLabs.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -278,6 +321,8 @@ partial void ProcessListWebhooksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +343,8 @@ partial void ProcessListWebhooksResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Authentication required or invalid credentials @@ -398,9 +445,13 @@ partial void ProcessListWebhooksResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::EachLabs.ListWebhooksResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::EachLabs.ListWebhooksResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { @@ -428,9 +479,13 @@ partial void ProcessListWebhooksResponseContent( #endif ).ConfigureAwait(false); - return - await global::EachLabs.ListWebhooksResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::EachLabs.ListWebhooksResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::EachLabs.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::EachLabs.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); } catch (global::System.Exception __ex) { diff --git a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.g.cs b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.g.cs index ff0ee90..da026a3 100644 --- a/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.g.cs +++ b/src/libs/EachLabs/Generated/EachLabs.WebhooksClient.g.cs @@ -74,10 +74,10 @@ public WebhooksClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public WebhooksClient( - global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null, - global::EachLabs.AutoSDKClientOptions? options = null, + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::EachLabs.AutoSDKClientOptions? options, bool disposeHttpClient = true) {