diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CancelABatchJob.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CancelABatchJob.g.cs
index c38c14c..8290803 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CancelABatchJob.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CancelABatchJob.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -45,10 +46,12 @@ partial void ProcessCancelABatchJobResponseContent(
/// Cancel a pending or processing batch job.
///
///
+ /// 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 CancelABatchJobAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessCancelABatchJobResponseContent(
securityRequirements: s_CancelABatchJobSecurityRequirements,
operationName: "CancelABatchJobAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: $"/v1/batch/{batchId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: $"/v1/batch/{batchId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,492 +112,651 @@ partial void ProcessCancelABatchJobResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCancelABatchJobRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- batchId: batchId);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCancelABatchJobResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCancelABatchJobRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ batchId: batchId);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CancelABatchJob",
+ methodName: "CancelABatchJobAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CancelABatchJob",
+ methodName: "CancelABatchJobAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CancelABatchJob",
+ methodName: "CancelABatchJobAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCancelABatchJobResponseContent(
+ response: __response);
+ ProcessCancelABatchJobResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CancelABatchJob",
+ methodName: "CancelABatchJobAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CancelABatchJob",
+ methodName: "CancelABatchJobAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCancelABatchJobResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
index bc3334f..5e7db68 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -45,11 +46,13 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
/// Submit a batch of texts for asynchronous embedding processing.
///
///
+ /// 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 CreateABatchEmbeddingJobAsync(
global::Jina.BatchEmbeddingRequest request,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -66,22 +69,43 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
securityRequirements: s_CreateABatchEmbeddingJobSecurityRequirements,
operationName: "CreateABatchEmbeddingJobAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: "/v1/batch/embeddings",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: "/v1/batch/embeddings",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -91,498 +115,657 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateABatchEmbeddingJobRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateABatchEmbeddingJobResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateABatchEmbeddingJobRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateABatchEmbeddingJob",
+ methodName: "CreateABatchEmbeddingJobAsync",
+ pathTemplate: "\"/v1/batch/embeddings\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateABatchEmbeddingJob",
+ methodName: "CreateABatchEmbeddingJobAsync",
+ pathTemplate: "\"/v1/batch/embeddings\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateABatchEmbeddingJob",
+ methodName: "CreateABatchEmbeddingJobAsync",
+ pathTemplate: "\"/v1/batch/embeddings\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateABatchEmbeddingJobResponseContent(
+ response: __response);
+ ProcessCreateABatchEmbeddingJobResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateABatchEmbeddingJob",
+ methodName: "CreateABatchEmbeddingJobAsync",
+ pathTemplate: "\"/v1/batch/embeddings\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateABatchEmbeddingJob",
+ methodName: "CreateABatchEmbeddingJobAsync",
+ pathTemplate: "\"/v1/batch/embeddings\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateABatchEmbeddingJobResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a batch embedding job
@@ -611,6 +794,7 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
///
/// URL to POST notification when job completes.
///
+ /// 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 CreateABatchEmbeddingJobAsync(
@@ -621,6 +805,7 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
bool? normalized = default,
string? task = default,
string? webhookUrl = default,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::Jina.BatchEmbeddingRequest
@@ -636,6 +821,7 @@ partial void ProcessCreateABatchEmbeddingJobResponseContent(
return await CreateABatchEmbeddingJobAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
index 50f3417..20f27e7 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -45,10 +46,12 @@ partial void ProcessDownloadBatchJobErrorFileResponseContent(
/// Stream the error JSONL file for a completed batch job.
///
///
+ /// 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 DownloadBatchJobErrorFileAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessDownloadBatchJobErrorFileResponseContent(
securityRequirements: s_DownloadBatchJobErrorFileSecurityRequirements,
operationName: "DownloadBatchJobErrorFileAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: $"/v1/batch/{batchId}/errors",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: $"/v1/batch/{batchId}/errors",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,488 +112,647 @@ partial void ProcessDownloadBatchJobErrorFileResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDownloadBatchJobErrorFileRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- batchId: batchId);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDownloadBatchJobErrorFileResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDownloadBatchJobErrorFileRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ batchId: batchId);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobErrorFile",
+ methodName: "DownloadBatchJobErrorFileAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/errors\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobErrorFile",
+ methodName: "DownloadBatchJobErrorFileAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/errors\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobErrorFile",
+ methodName: "DownloadBatchJobErrorFileAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/errors\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDownloadBatchJobErrorFileResponseContent(
+ response: __response);
+ ProcessDownloadBatchJobErrorFileResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return __content;
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobErrorFile",
+ methodName: "DownloadBatchJobErrorFileAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/errors\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobErrorFile",
+ methodName: "DownloadBatchJobErrorFileAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/errors\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return __content;
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessDownloadBatchJobErrorFileResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobOutput.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
index f4e9639..3191226 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -45,10 +46,12 @@ partial void ProcessDownloadBatchJobOutputResponseContent(
/// Stream the output JSONL file for a completed batch job.
///
///
+ /// 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 DownloadBatchJobOutputAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessDownloadBatchJobOutputResponseContent(
securityRequirements: s_DownloadBatchJobOutputSecurityRequirements,
operationName: "DownloadBatchJobOutputAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: $"/v1/batch/{batchId}/output",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: $"/v1/batch/{batchId}/output",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,488 +112,647 @@ partial void ProcessDownloadBatchJobOutputResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDownloadBatchJobOutputRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- batchId: batchId);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDownloadBatchJobOutputResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDownloadBatchJobOutputRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ batchId: batchId);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobOutput",
+ methodName: "DownloadBatchJobOutputAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/output\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobOutput",
+ methodName: "DownloadBatchJobOutputAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/output\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobOutput",
+ methodName: "DownloadBatchJobOutputAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/output\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDownloadBatchJobOutputResponseContent(
+ response: __response);
+ ProcessDownloadBatchJobOutputResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return __content;
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobOutput",
+ methodName: "DownloadBatchJobOutputAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/output\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DownloadBatchJobOutput",
+ methodName: "DownloadBatchJobOutputAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}/output\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return __content;
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessDownloadBatchJobOutputResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.GetBatchJobStatus.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.GetBatchJobStatus.g.cs
index e768227..da21838 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.GetBatchJobStatus.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.GetBatchJobStatus.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -45,10 +46,12 @@ partial void ProcessGetBatchJobStatusResponseContent(
/// Retrieve the status of a batch embedding job.
///
///
+ /// 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 GetBatchJobStatusAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessGetBatchJobStatusResponseContent(
securityRequirements: s_GetBatchJobStatusSecurityRequirements,
operationName: "GetBatchJobStatusAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: $"/v1/batch/{batchId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: $"/v1/batch/{batchId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,492 +112,651 @@ partial void ProcessGetBatchJobStatusResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetBatchJobStatusRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- batchId: batchId);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetBatchJobStatusResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetBatchJobStatusRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ batchId: batchId);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchJobStatus",
+ methodName: "GetBatchJobStatusAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchJobStatus",
+ methodName: "GetBatchJobStatusAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchJobStatus",
+ methodName: "GetBatchJobStatusAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetBatchJobStatusResponseContent(
+ response: __response);
+ ProcessGetBatchJobStatusResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchJobStatus",
+ methodName: "GetBatchJobStatusAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetBatchJobStatus",
+ methodName: "GetBatchJobStatusAsync",
+ pathTemplate: "$\"/v1/batch/{batchId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return
- await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetBatchJobStatusResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::Jina.BatchStatus.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::Jina.BatchStatus.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.ListBatchJobs.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.ListBatchJobs.g.cs
index b360ab6..a612b88 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.ListBatchJobs.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.ListBatchJobs.g.cs
@@ -14,6 +14,7 @@ public partial class BatchEmbeddingsClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -47,10 +48,12 @@ partial void ProcessListBatchJobsResponseContent(
///
/// Default Value: 20
///
+ /// 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> ListBatchJobsAsync(
int? limit = default,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -65,25 +68,46 @@ partial void ProcessListBatchJobsResponseContent(
securityRequirements: s_ListBatchJobsSecurityRequirements,
operationName: "ListBatchJobsAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: "/v1/batches",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("limit", limit?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: "/v1/batches",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("limit", limit?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -93,492 +117,651 @@ partial void ProcessListBatchJobsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListBatchJobsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- limit: limit);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListBatchJobsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::Jina.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_422 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareListBatchJobsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ limit: limit);
- throw new global::Jina.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListBatchJobs",
+ methodName: "ListBatchJobsAsync",
+ pathTemplate: "\"/v1/batches\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListBatchJobs",
+ methodName: "ListBatchJobsAsync",
+ pathTemplate: "\"/v1/batches\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListBatchJobs",
+ methodName: "ListBatchJobsAsync",
+ pathTemplate: "\"/v1/batches\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
+ break;
}
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
+ if (__response == null)
{
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListBatchJobsResponseContent(
+ response: __response);
+ ProcessListBatchJobsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return
- (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}\" ");
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListBatchJobs",
+ methodName: "ListBatchJobsAsync",
+ pathTemplate: "\"/v1/batches\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListBatchJobs",
+ methodName: "ListBatchJobsAsync",
+ pathTemplate: "\"/v1/batches\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#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) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::Jina.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::Jina.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessListBatchJobsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ (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}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #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) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.g.cs b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.g.cs
index 6cfbc58..42ff1cb 100644
--- a/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.BatchEmbeddingsClient.g.cs
@@ -36,6 +36,9 @@ public sealed partial class BatchEmbeddingsClient : global::Jina.IBatchEmbedding
#if DEBUG
= true;
#endif
+
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
///
///
///
@@ -55,11 +58,37 @@ public BatchEmbeddingsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the BatchEmbeddingsClient.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public BatchEmbeddingsClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::Jina.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::Jina.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/Jina/Generated/Jina.HealthCheckClient.Health.g.cs b/src/libs/Jina/Generated/Jina.HealthCheckClient.Health.g.cs
index d9b1c92..50456cb 100644
--- a/src/libs/Jina/Generated/Jina.HealthCheckClient.Health.g.cs
+++ b/src/libs/Jina/Generated/Jina.HealthCheckClient.Health.g.cs
@@ -14,6 +14,7 @@ public partial class HealthCheckClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -44,9 +45,11 @@ partial void ProcessHealthResponseContent(
/// Returns 200 if the service is running. This is the simplest health check
/// that only verifies the process is alive and can handle HTTP requests.
///
+ /// 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 HealthAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -60,22 +63,43 @@ partial void ProcessHealthResponseContent(
securityRequirements: s_HealthSecurityRequirements,
operationName: "HealthAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: "/health",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: "/health",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -85,449 +109,608 @@ partial void ProcessHealthResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareHealthRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessHealthResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareHealthRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest);
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Health",
+ methodName: "HealthAsync",
+ pathTemplate: "\"/health\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Health",
+ methodName: "HealthAsync",
+ pathTemplate: "\"/health\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Health",
+ methodName: "HealthAsync",
+ pathTemplate: "\"/health\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessHealthResponseContent(
+ response: __response);
+ ProcessHealthResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return __content;
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Health",
+ methodName: "HealthAsync",
+ pathTemplate: "\"/health\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Health",
+ methodName: "HealthAsync",
+ pathTemplate: "\"/health\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return __content;
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessHealthResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.HealthCheckClient.Live.g.cs b/src/libs/Jina/Generated/Jina.HealthCheckClient.Live.g.cs
index 6b966d9..4542d44 100644
--- a/src/libs/Jina/Generated/Jina.HealthCheckClient.Live.g.cs
+++ b/src/libs/Jina/Generated/Jina.HealthCheckClient.Live.g.cs
@@ -14,6 +14,7 @@ public partial class HealthCheckClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -46,9 +47,11 @@ partial void ProcessLiveResponseContent(
/// the event loop is not blocked and can handle requests.
/// A failed liveness probe typically results in container restart.
///
+ /// 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 LiveAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessLiveResponseContent(
securityRequirements: s_LiveSecurityRequirements,
operationName: "LiveAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: "/live",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: "/live",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,449 +111,608 @@ partial void ProcessLiveResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareLiveRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessLiveResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareLiveRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest);
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Live",
+ methodName: "LiveAsync",
+ pathTemplate: "\"/live\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Live",
+ methodName: "LiveAsync",
+ pathTemplate: "\"/live\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Live",
+ methodName: "LiveAsync",
+ pathTemplate: "\"/live\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessLiveResponseContent(
+ response: __response);
+ ProcessLiveResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return __content;
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Live",
+ methodName: "LiveAsync",
+ pathTemplate: "\"/live\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Live",
+ methodName: "LiveAsync",
+ pathTemplate: "\"/live\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return __content;
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessLiveResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.HealthCheckClient.Ready.g.cs b/src/libs/Jina/Generated/Jina.HealthCheckClient.Ready.g.cs
index 5a27a29..afb4fae 100644
--- a/src/libs/Jina/Generated/Jina.HealthCheckClient.Ready.g.cs
+++ b/src/libs/Jina/Generated/Jina.HealthCheckClient.Ready.g.cs
@@ -14,6 +14,7 @@ public partial class HealthCheckClient
{ new global::Jina.EndPointAuthorizationRequirement
{
Type = "Http",
+ SchemeId = "HttpBearer",
Location = "Header",
Name = "Bearer",
FriendlyName = "Bearer",
@@ -47,9 +48,11 @@ partial void ProcessReadyResponseContent(
/// 200 with status details if ready
/// 503 with failure details if not ready
///
+ /// 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 ReadyAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -63,22 +66,43 @@ partial void ProcessReadyResponseContent(
securityRequirements: s_ReadySecurityRequirements,
operationName: "ReadyAsync");
- var __pathBuilder = new global::Jina.PathBuilder(
- path: "/ready",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::Jina.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::Jina.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::Jina.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::Jina.PathBuilder(
+ path: "/ready",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::Jina.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Get,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif
foreach (var __authorization in __authorizations)
{
if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2")
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -88,449 +112,608 @@ partial void ProcessReadyResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareReadyRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessReadyResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::Jina.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ }
}
- // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::Jina.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ global::Jina.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::Jina.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::Jina.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::Jina.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareReadyRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest);
- throw new global::Jina.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::Jina.ErrorResponse? __value_429 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseObject = __value_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
- if ((int)__response.StatusCode == 500)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::Jina.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::Jina.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Ready",
+ methodName: "ReadyAsync",
+ pathTemplate: "\"/ready\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
-
- __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Ready",
+ methodName: "ReadyAsync",
+ pathTemplate: "\"/ready\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
- throw new global::Jina.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::Jina.ErrorResponse? __value_503 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::Jina.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Ready",
+ methodName: "ReadyAsync",
+ pathTemplate: "\"/ready\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::Jina.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
- }
-
- throw new global::Jina.ApiException(
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_503,
- ResponseObject = __value_503,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::Jina.ErrorResponse? __value_504 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
+ if (__response == null)
{
- __exception_504 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::Jina.ApiException(
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_504,
- ResponseObject = __value_504,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessReadyResponseContent(
+ response: __response);
+ ProcessReadyResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return __content;
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Ready",
+ methodName: "ReadyAsync",
+ pathTemplate: "\"/ready\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
- {
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ else
+ {
+ await global::Jina.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::Jina.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Ready",
+ methodName: "ReadyAsync",
+ pathTemplate: "\"/ready\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- return __content;
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ // - **INPUT_MODEL_NOT_FOUND**: Model 'model_name' not found. Available models: .... - **INPUT_INVALID_LABELS**: Invalid training labels. At least {min_labels} unique labels are required for training. - **INPUT_LABEL_LIMIT_EXCEEDED**: Label limit exceeded: {current} labels provided, maximum N allowed for your plan. Reduce the number of labels or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::Jina.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::Jina.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTH_MISSING_API_KEY**: Authentication required. Provide your API key via the Authorization header: 'Authorization: Bearer '. Get your API key at https://jina.ai/api-dashboard/key-manager. - **AUTH_INVALID_API_KEY**: Invalid API key. Verify your API key at https://jina.ai/api-dashboard/key-manager or generate a new one. - **AUTH_INVALID_FORMAT**: Invalid authorization format. Use 'Authorization: Bearer ' with a valid Jina API key (65 characters, starts with 'jina_').
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::Jina.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::Jina.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **AUTHZ_INSUFFICIENT_BALANCE**: Insufficient account balance. Top up your account at https://jina.ai/api-dashboard/key-manager. - **AUTHZ_RESOURCE_LIMIT_EXCEEDED**: Resource limit exceeded for your plan. Current: {current}, limit: N. Delete existing resources or upgrade your plan at https://jina.ai/api-dashboard/key-manager.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::Jina.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::Jina.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RESOURCE_NOT_FOUND**: {resource_type} '{resource_id}' not found or access denied. Verify the ID and your permissions.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::Jina.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::Jina.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **CONFLICT_RESOURCE_BUSY**: {resource_type} '{resource_id}' is currently being modified. Please retry after a few moments.
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::Jina.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::Jina.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **RATE_REQUEST_LIMIT_EXCEEDED**: Request rate limit exceeded: {current}/N requests per minute. Reduce request frequency or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_TOKEN_LIMIT_EXCEEDED**: Token rate limit exceeded: {current:,}/{limit:,} tokens per minute. Reduce batch sizes or upgrade your plan at https://jina.ai/api-dashboard/key-manager. - **RATE_CONCURRENCY_LIMIT_EXCEEDED**: Concurrency limit exceeded: {current}/N concurrent requests. Wait for pending requests to complete before sending new ones. - **RATE_IP_LIMIT_EXCEEDED**: IP rate limit exceeded. Too many requests from this IP address. Reduce request frequency.
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::Jina.ErrorResponse? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::Jina.ErrorResponse.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseObject = __value_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **INTERNAL_ERROR**: An unexpected error occurred. If this persists, contact support with the request_id from this response.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::Jina.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::Jina.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_UNAVAILABLE**: Service temporarily unavailable. Please retry with exponential backoff.
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::Jina.ErrorResponse? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::Jina.ErrorResponse.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_503,
+ ResponseObject = __value_503,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // - **SERVICE_TIMEOUT**: Request timed out after {timeout_seconds} seconds. Try with smaller inputs or retry later.
+ if ((int)__response.StatusCode == 504)
+ {
+ string? __content_504 = null;
+ global::System.Exception? __exception_504 = null;
+ global::Jina.ErrorResponse? __value_504 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ else
+ {
+ __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_504 = global::Jina.ErrorResponse.FromJson(__content_504, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_504 = __ex;
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_504,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_504,
+ ResponseObject = __value_504,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessReadyResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::Jina.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::Jina.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.HealthCheckClient.g.cs b/src/libs/Jina/Generated/Jina.HealthCheckClient.g.cs
index a1c9049..dec9b81 100644
--- a/src/libs/Jina/Generated/Jina.HealthCheckClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.HealthCheckClient.g.cs
@@ -31,6 +31,9 @@ public sealed partial class HealthCheckClient : global::Jina.IHealthCheckClient,
#if DEBUG
= true;
#endif
+
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
///
///
///
@@ -50,11 +53,37 @@ public HealthCheckClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the HealthCheckClient.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public HealthCheckClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::Jina.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::Jina.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CancelABatchJob.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CancelABatchJob.g.cs
index 88e1902..bfd969c 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CancelABatchJob.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CancelABatchJob.g.cs
@@ -9,10 +9,12 @@ public partial interface IBatchEmbeddingsClient
/// Cancel a pending or processing batch job.
///
///
+ /// 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 CancelABatchJobAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
index a5211ac..a0c8bde 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.CreateABatchEmbeddingJob.g.cs
@@ -9,11 +9,13 @@ public partial interface IBatchEmbeddingsClient
/// Submit a batch of texts for asynchronous embedding processing.
///
///
+ /// 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 CreateABatchEmbeddingJobAsync(
global::Jina.BatchEmbeddingRequest request,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a batch embedding job
@@ -42,6 +44,7 @@ public partial interface IBatchEmbeddingsClient
///
/// URL to POST notification when job completes.
///
+ /// 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 CreateABatchEmbeddingJobAsync(
@@ -52,6 +55,7 @@ public partial interface IBatchEmbeddingsClient
bool? normalized = default,
string? task = default,
string? webhookUrl = default,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
index dd7b839..791d421 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobErrorFile.g.cs
@@ -9,10 +9,12 @@ public partial interface IBatchEmbeddingsClient
/// Stream the error JSONL file for a completed batch job.
///
///
+ /// 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 DownloadBatchJobErrorFileAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobOutput.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
index b6466b8..964e355 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.DownloadBatchJobOutput.g.cs
@@ -9,10 +9,12 @@ public partial interface IBatchEmbeddingsClient
/// Stream the output JSONL file for a completed batch job.
///
///
+ /// 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 DownloadBatchJobOutputAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.GetBatchJobStatus.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.GetBatchJobStatus.g.cs
index 7dd03f0..4c0b3e3 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.GetBatchJobStatus.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.GetBatchJobStatus.g.cs
@@ -9,10 +9,12 @@ public partial interface IBatchEmbeddingsClient
/// Retrieve the status of a batch embedding job.
///
///
+ /// 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 GetBatchJobStatusAsync(
string batchId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.ListBatchJobs.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.ListBatchJobs.g.cs
index ba3c990..5ec313c 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.ListBatchJobs.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.ListBatchJobs.g.cs
@@ -11,10 +11,12 @@ public partial interface IBatchEmbeddingsClient
///
/// Default Value: 20
///
+ /// 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> ListBatchJobsAsync(
int? limit = default,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.g.cs b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.g.cs
index a4e6831..10b4935 100644
--- a/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.IBatchEmbeddingsClient.g.cs
@@ -38,6 +38,11 @@ public partial interface IBatchEmbeddingsClient : global::System.IDisposable
/// ensuring is populated.
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
+
///
///
diff --git a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Health.g.cs b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Health.g.cs
index af8e728..f66f627 100644
--- a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Health.g.cs
+++ b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Health.g.cs
@@ -10,9 +10,11 @@ public partial interface IHealthCheckClient
/// Returns 200 if the service is running. This is the simplest health check
/// that only verifies the process is alive and can handle HTTP requests.
///
+ /// 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 HealthAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Live.g.cs b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Live.g.cs
index a8bdb0a..2de1906 100644
--- a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Live.g.cs
+++ b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Live.g.cs
@@ -12,9 +12,11 @@ public partial interface IHealthCheckClient
/// the event loop is not blocked and can handle requests.
/// A failed liveness probe typically results in container restart.
///
+ /// 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 LiveAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Ready.g.cs b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Ready.g.cs
index d70623e..aaa9a35 100644
--- a/src/libs/Jina/Generated/Jina.IHealthCheckClient.Ready.g.cs
+++ b/src/libs/Jina/Generated/Jina.IHealthCheckClient.Ready.g.cs
@@ -13,9 +13,11 @@ public partial interface IHealthCheckClient
/// 200 with status details if ready
/// 503 with failure details if not ready
///
+ /// 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 ReadyAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IHealthCheckClient.g.cs b/src/libs/Jina/Generated/Jina.IHealthCheckClient.g.cs
index 201776d..341d840 100644
--- a/src/libs/Jina/Generated/Jina.IHealthCheckClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.IHealthCheckClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IHealthCheckClient : global::System.IDisposable
/// ensuring is populated.
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
+
///
///
diff --git a/src/libs/Jina/Generated/Jina.IJinaClient.g.cs b/src/libs/Jina/Generated/Jina.IJinaClient.g.cs
index 4b7bc32..f4cd354 100644
--- a/src/libs/Jina/Generated/Jina.IJinaClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.IJinaClient.g.cs
@@ -74,6 +74,11 @@ public partial interface IJinaClient : global::System.IDisposable
/// ensuring is populated.
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
+
///
///
diff --git a/src/libs/Jina/Generated/Jina.IModelListClient.GetModel.g.cs b/src/libs/Jina/Generated/Jina.IModelListClient.GetModel.g.cs
index 20dfec2..ff26f4c 100644
--- a/src/libs/Jina/Generated/Jina.IModelListClient.GetModel.g.cs
+++ b/src/libs/Jina/Generated/Jina.IModelListClient.GetModel.g.cs
@@ -11,10 +11,12 @@ public partial interface IModelListClient
/// short form (`jina-embeddings-v3`).
///
///
+ /// 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 GetModelAsync(
string modelId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IModelListClient.ListModels.g.cs b/src/libs/Jina/Generated/Jina.IModelListClient.ListModels.g.cs
index e9c848e..756bea0 100644
--- a/src/libs/Jina/Generated/Jina.IModelListClient.ListModels.g.cs
+++ b/src/libs/Jina/Generated/Jina.IModelListClient.ListModels.g.cs
@@ -10,9 +10,11 @@ public partial interface IModelListClient
/// Returns model metadata in OpenRouter-compatible format including
/// model IDs, input/output modalities, context lengths, and pricing.
///
+ /// 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 ListModelsAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IModelListClient.g.cs b/src/libs/Jina/Generated/Jina.IModelListClient.g.cs
index eeb9224..a185194 100644
--- a/src/libs/Jina/Generated/Jina.IModelListClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.IModelListClient.g.cs
@@ -34,6 +34,11 @@ public partial interface IModelListClient : global::System.IDisposable
/// ensuring is populated.
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
+
///
///
diff --git a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.ChatCompletionsExperimental.g.cs b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.ChatCompletionsExperimental.g.cs
index c241672..1176d9c 100644
--- a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.ChatCompletionsExperimental.g.cs
+++ b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.ChatCompletionsExperimental.g.cs
@@ -9,9 +9,11 @@ public partial interface ISearchFoundationModelsClient
/// **Experimental** - This endpoint is for testing purposes only. We do not guarantee its availability, scalability, or production-readiness. It may be removed or changed without notice.
/// Generate a chat completion using jina-vlm (Vision Language Model). Supports text-only and multimodal (text + image) inputs in OpenAI-compatible format.
///
+ /// 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 ChatCompletionsExperimentalAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Embeddings.g.cs b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Embeddings.g.cs
index 0b1f6ee..e1fec60 100644
--- a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Embeddings.g.cs
+++ b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Embeddings.g.cs
@@ -11,11 +11,13 @@ public partial interface ISearchFoundationModelsClient
/// similarity matching, clustering, and classification tasks.
///
///
+ /// 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 EmbeddingsAsync(
global::Jina.EmbeddingsV1EmbeddingsPostRequest request,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Embeddings
@@ -23,9 +25,11 @@ public partial interface ISearchFoundationModelsClient
/// World-class multimodal multilingual embeddings for semantic search,
/// similarity matching, clustering, and classification tasks.
///
+ /// 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 EmbeddingsAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Rerank.g.cs b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Rerank.g.cs
index cf70cd1..9790677 100644
--- a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Rerank.g.cs
+++ b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.Rerank.g.cs
@@ -10,20 +10,24 @@ public partial interface ISearchFoundationModelsClient
/// World-class reranker for maximizing search relevancy and RAG accuracy.
///
///
+ /// 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 RerankAsync(
global::Jina.RerankV1RerankPostRequest request,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Rerank
/// Rerank documents by relevance to a query.
/// World-class reranker for maximizing search relevancy and RAG accuracy.
///
+ /// 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 RerankAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.g.cs b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.g.cs
index 5f43353..8bba0f6 100644
--- a/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.g.cs
+++ b/src/libs/Jina/Generated/Jina.ISearchFoundationModelsClient.g.cs
@@ -35,6 +35,11 @@ public partial interface ISearchFoundationModelsClient : global::System.IDisposa
/// ensuring is populated.
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::Jina.AutoSDKClientOptions Options { get; }
+
///
///
diff --git a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.Classify.g.cs b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.Classify.g.cs
index b0b2068..586636f 100644
--- a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.Classify.g.cs
+++ b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.Classify.g.cs
@@ -11,11 +11,13 @@ public partial interface IZeroFewShotClassificationClient
/// few-shot uses a trained classifier.
///
///
+ /// 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 ClassifyAsync(
global::Jina.AnyOf request,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Classify
@@ -23,9 +25,11 @@ public partial interface IZeroFewShotClassificationClient
/// Zero-shot and few-shot classification. Zero-shot uses embedding similarity,
/// few-shot uses a trained classifier.
///
+ /// 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 ClassifyAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.DeleteClassifier.g.cs b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.DeleteClassifier.g.cs
index 0dc5771..e9d5f19 100644
--- a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.DeleteClassifier.g.cs
+++ b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.DeleteClassifier.g.cs
@@ -9,10 +9,12 @@ public partial interface IZeroFewShotClassificationClient
/// Delete a classifier by 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 DeleteClassifierAsync(
string classifierId,
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers.g.cs b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers.g.cs
index 457e520..e96893e 100644
--- a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers.g.cs
+++ b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers.g.cs
@@ -8,9 +8,11 @@ public partial interface IZeroFewShotClassificationClient
/// List Classifiers
/// List all classifiers owned by the authenticated user.
///
+ /// 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> ListClassifiersAsync(
+ global::Jina.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers2.g.cs b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers2.g.cs
index 8a3b2a6..1fb1aea 100644
--- a/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers2.g.cs
+++ b/src/libs/Jina/Generated/Jina.IZeroFewShotClassificationClient.ListClassifiers2.g.cs
@@ -8,9 +8,11 @@ public partial interface IZeroFewShotClassificationClient
/// List Classifiers