diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountEmailValues.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountEmailValues.g.cs
new file mode 100644
index 00000000..14778aeb
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountEmailValues.g.cs
@@ -0,0 +1,504 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_AccountEmailValuesSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_AccountEmailValuesSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_AccountEmailValuesSecurityRequirement0,
+ };
+ partial void PrepareAccountEmailValuesArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey);
+ partial void PrepareAccountEmailValuesRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey);
+ partial void ProcessAccountEmailValuesResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessAccountEmailValuesResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Account Email Values
+ ///
+ ///
+ /// 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 AccountEmailValuesAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await AccountEmailValuesAsResponseAsync(
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Account Email Values
+ ///
+ ///
+ /// 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> AccountEmailValuesAsResponseAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareAccountEmailValuesArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_AccountEmailValuesSecurityRequirements,
+ operationName: "AccountEmailValuesAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/emails",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAccountEmailValuesRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountEmailValues",
+ methodName: "AccountEmailValuesAsync",
+ pathTemplate: "\"/v1/me/emails\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountEmailValues",
+ methodName: "AccountEmailValuesAsync",
+ pathTemplate: "\"/v1/me/emails\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountEmailValues",
+ methodName: "AccountEmailValuesAsync",
+ pathTemplate: "\"/v1/me/emails\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAccountEmailValuesResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountEmailValues",
+ methodName: "AccountEmailValuesAsync",
+ pathTemplate: "\"/v1/me/emails\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountEmailValues",
+ methodName: "AccountEmailValuesAsync",
+ pathTemplate: "\"/v1/me/emails\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessAccountEmailValuesResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.EmailsOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.EmailsOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AccountClient.AccountGpuLimit.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountGpuLimit.g.cs
new file mode 100644
index 00000000..ca95c048
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountGpuLimit.g.cs
@@ -0,0 +1,504 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_AccountGpuLimitSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_AccountGpuLimitSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_AccountGpuLimitSecurityRequirement0,
+ };
+ partial void PrepareAccountGpuLimitArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey);
+ partial void PrepareAccountGpuLimitRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey);
+ partial void ProcessAccountGpuLimitResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessAccountGpuLimitResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Account Gpu Limit
+ ///
+ ///
+ /// 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 AccountGpuLimitAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await AccountGpuLimitAsResponseAsync(
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Account Gpu Limit
+ ///
+ ///
+ /// 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> AccountGpuLimitAsResponseAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareAccountGpuLimitArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_AccountGpuLimitSecurityRequirements,
+ operationName: "AccountGpuLimitAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/gpu_limit",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAccountGpuLimitRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountGpuLimit",
+ methodName: "AccountGpuLimitAsync",
+ pathTemplate: "\"/v1/me/gpu_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountGpuLimit",
+ methodName: "AccountGpuLimitAsync",
+ pathTemplate: "\"/v1/me/gpu_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountGpuLimit",
+ methodName: "AccountGpuLimitAsync",
+ pathTemplate: "\"/v1/me/gpu_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAccountGpuLimitResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountGpuLimit",
+ methodName: "AccountGpuLimitAsync",
+ pathTemplate: "\"/v1/me/gpu_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountGpuLimit",
+ methodName: "AccountGpuLimitAsync",
+ pathTemplate: "\"/v1/me/gpu_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessAccountGpuLimitResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.GpuLimitOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.GpuLimitOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AccountClient.AccountRateLimit.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountRateLimit.g.cs
new file mode 100644
index 00000000..bdb6b8e3
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountRateLimit.g.cs
@@ -0,0 +1,504 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_AccountRateLimitSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_AccountRateLimitSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_AccountRateLimitSecurityRequirement0,
+ };
+ partial void PrepareAccountRateLimitArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey);
+ partial void PrepareAccountRateLimitRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey);
+ partial void ProcessAccountRateLimitResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessAccountRateLimitResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Account Rate Limit
+ ///
+ ///
+ /// 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 AccountRateLimitAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await AccountRateLimitAsResponseAsync(
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Account Rate Limit
+ ///
+ ///
+ /// 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> AccountRateLimitAsResponseAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareAccountRateLimitArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_AccountRateLimitSecurityRequirements,
+ operationName: "AccountRateLimitAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/rate_limit",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAccountRateLimitRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountRateLimit",
+ methodName: "AccountRateLimitAsync",
+ pathTemplate: "\"/v1/me/rate_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountRateLimit",
+ methodName: "AccountRateLimitAsync",
+ pathTemplate: "\"/v1/me/rate_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountRateLimit",
+ methodName: "AccountRateLimitAsync",
+ pathTemplate: "\"/v1/me/rate_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAccountRateLimitResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountRateLimit",
+ methodName: "AccountRateLimitAsync",
+ pathTemplate: "\"/v1/me/rate_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountRateLimit",
+ methodName: "AccountRateLimitAsync",
+ pathTemplate: "\"/v1/me/rate_limit\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessAccountRateLimitResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.RateLimitOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.RateLimitOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AccountClient.AccountUpdateDetails.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountUpdateDetails.g.cs
new file mode 100644
index 00000000..db60cd01
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.AccountUpdateDetails.g.cs
@@ -0,0 +1,645 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_AccountUpdateDetailsSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_AccountUpdateDetailsSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_AccountUpdateDetailsSecurityRequirement0,
+ };
+ partial void PrepareAccountUpdateDetailsArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey,
+ global::DeepInfra.MeIn request);
+ partial void PrepareAccountUpdateDetailsRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey,
+ global::DeepInfra.MeIn request);
+ partial void ProcessAccountUpdateDetailsResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessAccountUpdateDetailsResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Account Update Details
+ ///
+ ///
+ ///
+ /// 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 AccountUpdateDetailsAsync(
+
+ global::DeepInfra.MeIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await AccountUpdateDetailsAsResponseAsync(
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Account Update Details
+ ///
+ ///
+ ///
+ /// 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> AccountUpdateDetailsAsResponseAsync(
+
+ global::DeepInfra.MeIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareAccountUpdateDetailsArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_AccountUpdateDetailsSecurityRequirements,
+ operationName: "AccountUpdateDetailsAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAccountUpdateDetailsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountUpdateDetails",
+ methodName: "AccountUpdateDetailsAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountUpdateDetails",
+ methodName: "AccountUpdateDetailsAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountUpdateDetails",
+ methodName: "AccountUpdateDetailsAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAccountUpdateDetailsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountUpdateDetails",
+ methodName: "AccountUpdateDetailsAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AccountUpdateDetails",
+ methodName: "AccountUpdateDetailsAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ responseBody: __content_409,
+ responseObject: __value_409,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Unprocessable Entity
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::DeepInfra.DeepError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.DeepError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.DeepError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessAccountUpdateDetailsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Account Update Details
+ ///
+ ///
+ ///
+ /// Personal name
+ ///
+ ///
+ /// First name of the user
+ ///
+ ///
+ /// Last name of the user
+ ///
+ ///
+ /// Country of the user
+ ///
+ ///
+ ///
+ ///
+ /// Company name
+ ///
+ ///
+ /// Company website address
+ ///
+ ///
+ /// Job title of the user, e.g. 'Software Engineer'
+ ///
+ ///
+ /// String with length between 1 and 39 characters. Only alphanumeric characters and dashes allowed. Must contain no leading, trailing or consecutive dashes.
+ ///
+ ///
+ /// Short description of the use case for the account
+ ///
+ ///
+ /// Short description of how the user found out about DeepInfra
+ ///
+ ///
+ /// Set to false to opt out of marketing emails
+ ///
+ ///
+ /// ISO 3166-1 alpha-2 country code of the user selected country
+ ///
+ /// 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 AccountUpdateDetailsAsync(
+ string? xiApiKey = default,
+ string? name = default,
+ string? firstName = default,
+ string? lastName = default,
+ string? country = default,
+ string? email = default,
+ bool? isBusinessAccount = default,
+ string? company = default,
+ string? website = default,
+ string? title = default,
+ string? displayName = default,
+ string? useCase = default,
+ string? attribution = default,
+ bool? marketingEmails = default,
+ string? countryCode = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.MeIn
+ {
+ Name = name,
+ FirstName = firstName,
+ LastName = lastName,
+ Country = country,
+ Email = email,
+ IsBusinessAccount = isBusinessAccount,
+ Company = company,
+ Website = website,
+ Title = title,
+ DisplayName = displayName,
+ UseCase = useCase,
+ Attribution = attribution,
+ MarketingEmails = marketingEmails,
+ CountryCode = countryCode,
+ };
+
+ return await AccountUpdateDetailsAsync(
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.DeleteAccount.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.DeleteAccount.g.cs
new file mode 100644
index 00000000..028e256c
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.DeleteAccount.g.cs
@@ -0,0 +1,467 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_DeleteAccountSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_DeleteAccountSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_DeleteAccountSecurityRequirement0,
+ };
+ partial void PrepareDeleteAccountArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey);
+ partial void PrepareDeleteAccountRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey);
+ partial void ProcessDeleteAccountResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessDeleteAccountResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Delete Account
+ ///
+ ///
+ /// 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 DeleteAccountAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteAccountAsResponseAsync(
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Delete Account
+ ///
+ ///
+ /// 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> DeleteAccountAsResponseAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareDeleteAccountArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_DeleteAccountSecurityRequirements,
+ operationName: "DeleteAccountAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteAccountRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAccount",
+ methodName: "DeleteAccountAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAccount",
+ methodName: "DeleteAccountAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAccount",
+ methodName: "DeleteAccountAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteAccountResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAccount",
+ methodName: "DeleteAccountAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteAccount",
+ methodName: "DeleteAccountAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessDeleteAccountResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.Me.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.Me.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AccountClient.Me.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.Me.g.cs
new file mode 100644
index 00000000..994f0f9b
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.Me.g.cs
@@ -0,0 +1,483 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_MeSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_MeSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_MeSecurityRequirement0,
+ };
+ partial void PrepareMeArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref bool? checklist,
+ ref string? xiApiKey);
+ partial void PrepareMeRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ bool? checklist,
+ string? xiApiKey);
+ partial void ProcessMeResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessMeResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Me
+ ///
+ ///
+ /// Default Value: false
+ ///
+ ///
+ /// 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 MeAsync(
+ bool? checklist = default,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await MeAsResponseAsync(
+ checklist: checklist,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Me
+ ///
+ ///
+ /// Default Value: false
+ ///
+ ///
+ /// 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> MeAsResponseAsync(
+ bool? checklist = default,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareMeArguments(
+ httpClient: HttpClient,
+ checklist: ref checklist,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_MeSecurityRequirements,
+ operationName: "MeAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("checklist", checklist?.ToString().ToLowerInvariant())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareMeRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ checklist: checklist,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Me",
+ methodName: "MeAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Me",
+ methodName: "MeAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Me",
+ methodName: "MeAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessMeResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Me",
+ methodName: "MeAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "Me",
+ methodName: "MeAsync",
+ pathTemplate: "\"/v1/me\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessMeResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.Me.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.Me.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AccountClient.RequestGpuLimitIncrease.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.RequestGpuLimitIncrease.g.cs
new file mode 100644
index 00000000..a808aa84
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.RequestGpuLimitIncrease.g.cs
@@ -0,0 +1,588 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_RequestGpuLimitIncreaseSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_RequestGpuLimitIncreaseSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_RequestGpuLimitIncreaseSecurityRequirement0,
+ };
+ partial void PrepareRequestGpuLimitIncreaseArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey,
+ global::DeepInfra.GpuLimitRequestIn request);
+ partial void PrepareRequestGpuLimitIncreaseRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey,
+ global::DeepInfra.GpuLimitRequestIn request);
+ partial void ProcessRequestGpuLimitIncreaseResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessRequestGpuLimitIncreaseResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Request Gpu Limit Increase
+ ///
+ ///
+ ///
+ /// 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 RequestGpuLimitIncreaseAsync(
+
+ global::DeepInfra.GpuLimitRequestIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RequestGpuLimitIncreaseAsResponseAsync(
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Request Gpu Limit Increase
+ ///
+ ///
+ ///
+ /// 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> RequestGpuLimitIncreaseAsResponseAsync(
+
+ global::DeepInfra.GpuLimitRequestIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareRequestGpuLimitIncreaseArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_RequestGpuLimitIncreaseSecurityRequirements,
+ operationName: "RequestGpuLimitIncreaseAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/gpu_limit/request",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareRequestGpuLimitIncreaseRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestGpuLimitIncrease",
+ methodName: "RequestGpuLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/gpu_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestGpuLimitIncrease",
+ methodName: "RequestGpuLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/gpu_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestGpuLimitIncrease",
+ methodName: "RequestGpuLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/gpu_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessRequestGpuLimitIncreaseResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestGpuLimitIncrease",
+ methodName: "RequestGpuLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/gpu_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestGpuLimitIncrease",
+ methodName: "RequestGpuLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/gpu_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Forbidden
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::DeepInfra.DeepError? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::DeepInfra.DeepError.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::DeepInfra.DeepError.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ responseBody: __content_403,
+ responseObject: __value_403,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessRequestGpuLimitIncreaseResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Request Gpu Limit Increase
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 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 RequestGpuLimitIncreaseAsync(
+ string gpuType,
+ int requestedLimit,
+ string reason,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.GpuLimitRequestIn
+ {
+ GpuType = gpuType,
+ RequestedLimit = requestedLimit,
+ Reason = reason,
+ };
+
+ return await RequestGpuLimitIncreaseAsync(
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.RequestRateLimitIncrease.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.RequestRateLimitIncrease.g.cs
new file mode 100644
index 00000000..12671f31
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.RequestRateLimitIncrease.g.cs
@@ -0,0 +1,588 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_RequestRateLimitIncreaseSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_RequestRateLimitIncreaseSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_RequestRateLimitIncreaseSecurityRequirement0,
+ };
+ partial void PrepareRequestRateLimitIncreaseArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey,
+ global::DeepInfra.RateLimitRequestIn request);
+ partial void PrepareRequestRateLimitIncreaseRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey,
+ global::DeepInfra.RateLimitRequestIn request);
+ partial void ProcessRequestRateLimitIncreaseResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessRequestRateLimitIncreaseResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Request Rate Limit Increase
+ ///
+ ///
+ ///
+ /// 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 RequestRateLimitIncreaseAsync(
+
+ global::DeepInfra.RateLimitRequestIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RequestRateLimitIncreaseAsResponseAsync(
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Request Rate Limit Increase
+ ///
+ ///
+ ///
+ /// 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> RequestRateLimitIncreaseAsResponseAsync(
+
+ global::DeepInfra.RateLimitRequestIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareRequestRateLimitIncreaseArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_RequestRateLimitIncreaseSecurityRequirements,
+ operationName: "RequestRateLimitIncreaseAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/rate_limit/request",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareRequestRateLimitIncreaseRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestRateLimitIncrease",
+ methodName: "RequestRateLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/rate_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestRateLimitIncrease",
+ methodName: "RequestRateLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/rate_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestRateLimitIncrease",
+ methodName: "RequestRateLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/rate_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessRequestRateLimitIncreaseResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestRateLimitIncrease",
+ methodName: "RequestRateLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/rate_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RequestRateLimitIncrease",
+ methodName: "RequestRateLimitIncreaseAsync",
+ pathTemplate: "\"/v1/me/rate_limit/request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Forbidden
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::DeepInfra.DeepError? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::DeepInfra.DeepError.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::DeepInfra.DeepError.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ responseBody: __content_403,
+ responseObject: __value_403,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessRequestRateLimitIncreaseResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Request Rate Limit Increase
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// 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 RequestRateLimitIncreaseAsync(
+ int rateLimit,
+ string reason,
+ string? xiApiKey = default,
+ int? tpmRateLimit = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.RateLimitRequestIn
+ {
+ RateLimit = rateLimit,
+ TpmRateLimit = tpmRateLimit,
+ Reason = reason,
+ };
+
+ return await RequestRateLimitIncreaseAsync(
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.TeamSetDisplayName.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.TeamSetDisplayName.g.cs
new file mode 100644
index 00000000..d74be8d0
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.TeamSetDisplayName.g.cs
@@ -0,0 +1,584 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AccountClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_TeamSetDisplayNameSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_TeamSetDisplayNameSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_TeamSetDisplayNameSecurityRequirement0,
+ };
+ partial void PrepareTeamSetDisplayNameArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey,
+ global::DeepInfra.DisplayNameIn request);
+ partial void PrepareTeamSetDisplayNameRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey,
+ global::DeepInfra.DisplayNameIn request);
+ partial void ProcessTeamSetDisplayNameResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessTeamSetDisplayNameResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Team Set Display Name
+ ///
+ ///
+ ///
+ /// 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 TeamSetDisplayNameAsync(
+
+ global::DeepInfra.DisplayNameIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await TeamSetDisplayNameAsResponseAsync(
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Team Set Display Name
+ ///
+ ///
+ ///
+ /// 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> TeamSetDisplayNameAsResponseAsync(
+
+ global::DeepInfra.DisplayNameIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareTeamSetDisplayNameArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_TeamSetDisplayNameSecurityRequirements,
+ operationName: "TeamSetDisplayNameAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/me/team_display_name",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareTeamSetDisplayNameRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TeamSetDisplayName",
+ methodName: "TeamSetDisplayNameAsync",
+ pathTemplate: "\"/v1/me/team_display_name\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TeamSetDisplayName",
+ methodName: "TeamSetDisplayNameAsync",
+ pathTemplate: "\"/v1/me/team_display_name\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TeamSetDisplayName",
+ methodName: "TeamSetDisplayNameAsync",
+ pathTemplate: "\"/v1/me/team_display_name\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessTeamSetDisplayNameResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TeamSetDisplayName",
+ methodName: "TeamSetDisplayNameAsync",
+ pathTemplate: "\"/v1/me/team_display_name\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TeamSetDisplayName",
+ methodName: "TeamSetDisplayNameAsync",
+ pathTemplate: "\"/v1/me/team_display_name\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessTeamSetDisplayNameResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Team Set Display Name
+ ///
+ ///
+ ///
+ /// String with length between 1 and 39 characters. Only alphanumeric characters and dashes allowed. Must contain no leading, trailing or consecutive dashes.
+ ///
+ /// 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 TeamSetDisplayNameAsync(
+ string displayName,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.DisplayNameIn
+ {
+ DisplayName = displayName,
+ };
+
+ return await TeamSetDisplayNameAsync(
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.g.cs
new file mode 100644
index 00000000..ae7caaa8
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AccountClient.g.cs
@@ -0,0 +1,137 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ ///
+ /// User profile, team management, and rate limits.
+ /// 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.
+ ///
+ public sealed partial class AccountClient : global::DeepInfra.IAccountClient, global::System.IDisposable
+ {
+ ///
+ ///
+ ///
+ public const string DefaultBaseUrl = "https://api.deepinfra.com/";
+
+ private bool _disposeHttpClient = true;
+
+ ///
+ public global::System.Net.Http.HttpClient HttpClient { get; }
+
+ ///
+ public System.Uri? BaseUri => HttpClient.BaseAddress;
+
+ ///
+ public global::System.Collections.Generic.List Authorizations { get; }
+
+ ///
+ public bool ReadResponseAsString { get; set; }
+#if DEBUG
+ = true;
+#endif
+
+ ///
+ public global::DeepInfra.AutoSDKClientOptions Options { get; }
+ ///
+ ///
+ ///
+ public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::DeepInfra.SourceGenerationContext.Default;
+
+
+ ///
+ /// Creates a new instance of the AccountClient.
+ /// 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.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public AccountClient(
+ 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 AccountClient with explicit options but no base URL override.
+ /// Skips passing baseUri so the default base URL from the OpenAPI spec applies.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// 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 AccountClient(
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Collections.Generic.List? authorizations,
+ global::DeepInfra.AutoSDKClientOptions? options,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri: null,
+ authorizations,
+ options,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the AccountClient.
+ /// 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 AccountClient(
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::DeepInfra.AutoSDKClientOptions? options,
+ 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::DeepInfra.AutoSDKClientOptions();
+ _disposeHttpClient = disposeHttpClient;
+
+ Initialized(HttpClient);
+ }
+
+ ///
+ public void Dispose()
+ {
+ if (_disposeHttpClient)
+ {
+ HttpClient.Dispose();
+ }
+ }
+
+ partial void Initialized(
+ global::System.Net.Http.HttpClient client);
+ partial void PrepareArguments(
+ global::System.Net.Http.HttpClient client);
+ partial void PrepareRequest(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpRequestMessage request);
+ partial void ProcessResponse(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpResponseMessage response);
+ partial void ProcessResponseContent(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpResponseMessage response,
+ ref string content);
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCatalog.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCatalog.g.cs
new file mode 100644
index 00000000..9836709f
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCatalog.g.cs
@@ -0,0 +1,541 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawCatalogSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawCatalogSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawCatalogSecurityRequirement0,
+ };
+ partial void PrepareOpenclawCatalogArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawCatalogRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey);
+ partial void ProcessOpenclawCatalogResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawCatalogResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Catalog
+ ///
+ ///
+ /// 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> OpenclawCatalogAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawCatalogAsResponseAsync(
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Catalog
+ ///
+ ///
+ /// 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>> OpenclawCatalogAsResponseAsync(
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawCatalogArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawCatalogSecurityRequirements,
+ operationName: "OpenclawCatalogAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/agents/catalog",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawCatalogRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCatalog",
+ methodName: "OpenclawCatalogAsync",
+ pathTemplate: "\"/v1/agents/catalog\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCatalog",
+ methodName: "OpenclawCatalogAsync",
+ pathTemplate: "\"/v1/agents/catalog\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCatalog",
+ methodName: "OpenclawCatalogAsync",
+ pathTemplate: "\"/v1/agents/catalog\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawCatalogResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCatalog",
+ methodName: "OpenclawCatalogAsync",
+ pathTemplate: "\"/v1/agents/catalog\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCatalog",
+ methodName: "OpenclawCatalogAsync",
+ pathTemplate: "\"/v1/agents/catalog\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawCatalogResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = (global::System.Collections.Generic.Dictionary?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.Dictionary), JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = (global::System.Collections.Generic.Dictionary?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.Dictionary), JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCreate.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCreate.g.cs
new file mode 100644
index 00000000..ec29c046
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawCreate.g.cs
@@ -0,0 +1,711 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawCreateSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawCreateSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawCreateSecurityRequirement0,
+ };
+ partial void PrepareOpenclawCreateArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string? xiApiKey,
+ global::DeepInfra.OpenClawCreateIn request);
+ partial void PrepareOpenclawCreateRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string? xiApiKey,
+ global::DeepInfra.OpenClawCreateIn request);
+ partial void ProcessOpenclawCreateResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawCreateResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Create
+ ///
+ ///
+ ///
+ /// 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 OpenclawCreateAsync(
+
+ global::DeepInfra.OpenClawCreateIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawCreateAsResponseAsync(
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Create
+ ///
+ ///
+ ///
+ /// 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> OpenclawCreateAsResponseAsync(
+
+ global::DeepInfra.OpenClawCreateIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawCreateArguments(
+ httpClient: HttpClient,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawCreateSecurityRequirements,
+ operationName: "OpenclawCreateAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/agents",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawCreateRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCreate",
+ methodName: "OpenclawCreateAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCreate",
+ methodName: "OpenclawCreateAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCreate",
+ methodName: "OpenclawCreateAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawCreateResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCreate",
+ methodName: "OpenclawCreateAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawCreate",
+ methodName: "OpenclawCreateAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::DeepInfra.DeepError? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::DeepInfra.DeepError.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::DeepInfra.DeepError.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ responseBody: __content_400,
+ responseObject: __value_400,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Payment Required
+ if ((int)__response.StatusCode == 402)
+ {
+ string? __content_402 = null;
+ global::System.Exception? __exception_402 = null;
+ global::DeepInfra.DeepError? __value_402 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_402 = global::DeepInfra.DeepError.FromJson(__content_402, JsonSerializerContext);
+ }
+ else
+ {
+ __content_402 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_402 = global::DeepInfra.DeepError.FromJson(__content_402, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_402 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_402 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_402,
+ responseBody: __content_402,
+ responseObject: __value_402,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Too Many Requests
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ global::DeepInfra.DeepError? __value_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_429 = global::DeepInfra.DeepError.FromJson(__content_429, JsonSerializerContext);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_429 = global::DeepInfra.DeepError.FromJson(__content_429, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ responseBody: __content_429,
+ responseObject: __value_429,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Service Unavailable
+ if ((int)__response.StatusCode == 503)
+ {
+ string? __content_503 = null;
+ global::System.Exception? __exception_503 = null;
+ global::DeepInfra.DeepError? __value_503 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_503 = global::DeepInfra.DeepError.FromJson(__content_503, JsonSerializerContext);
+ }
+ else
+ {
+ __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_503 = global::DeepInfra.DeepError.FromJson(__content_503, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_503 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_503,
+ responseBody: __content_503,
+ responseObject: __value_503,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawCreateResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.OpenClawCreateOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.OpenClawCreateOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Openclaw Create
+ ///
+ ///
+ ///
+ /// Instance name
+ ///
+ ///
+ /// Agent type identifier
+ /// Default Value: openclaw
+ ///
+ ///
+ /// Plan identifier
+ /// Default Value: standard
+ ///
+ /// 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 OpenclawCreateAsync(
+ string name,
+ string? xiApiKey = default,
+ string? agentTypeId = default,
+ string? planId = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.OpenClawCreateIn
+ {
+ Name = name,
+ AgentTypeId = agentTypeId,
+ PlanId = planId,
+ };
+
+ return await OpenclawCreateAsync(
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawDelete.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawDelete.g.cs
new file mode 100644
index 00000000..842f12d2
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawDelete.g.cs
@@ -0,0 +1,546 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawDeleteSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawDeleteSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawDeleteSecurityRequirement0,
+ };
+ partial void PrepareOpenclawDeleteArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawDeleteRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawDeleteResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawDeleteResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Delete
+ ///
+ ///
+ ///
+ /// 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 OpenclawDeleteAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawDeleteAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Delete
+ ///
+ ///
+ ///
+ /// 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> OpenclawDeleteAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawDeleteArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawDeleteSecurityRequirements,
+ operationName: "OpenclawDeleteAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawDeleteRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawDelete",
+ methodName: "OpenclawDeleteAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawDelete",
+ methodName: "OpenclawDeleteAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawDelete",
+ methodName: "OpenclawDeleteAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawDeleteResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawDelete",
+ methodName: "OpenclawDeleteAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawDelete",
+ methodName: "OpenclawDeleteAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawDeleteResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawGet.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawGet.g.cs
new file mode 100644
index 00000000..736d0e6e
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawGet.g.cs
@@ -0,0 +1,550 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawGetSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawGetSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawGetSecurityRequirement0,
+ };
+ partial void PrepareOpenclawGetArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawGetRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawGetResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawGetResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Get
+ ///
+ ///
+ ///
+ /// 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 OpenclawGetAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawGetAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Get
+ ///
+ ///
+ ///
+ /// 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> OpenclawGetAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawGetArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawGetSecurityRequirements,
+ operationName: "OpenclawGetAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawGetRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawGet",
+ methodName: "OpenclawGetAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawGet",
+ methodName: "OpenclawGetAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawGet",
+ methodName: "OpenclawGetAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawGetResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawGet",
+ methodName: "OpenclawGetAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawGet",
+ methodName: "OpenclawGetAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawGetResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.OpenClawInstanceOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.OpenClawInstanceOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawLaunchToken.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawLaunchToken.g.cs
new file mode 100644
index 00000000..351f7565
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawLaunchToken.g.cs
@@ -0,0 +1,605 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawLaunchTokenSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawLaunchTokenSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawLaunchTokenSecurityRequirement0,
+ };
+ partial void PrepareOpenclawLaunchTokenArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawLaunchTokenRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawLaunchTokenResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawLaunchTokenResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Launch Token
+ /// Mint a single-use launch URL for the dashboard.
+ /// Called by the launcher page right when readyz flips ready. The launch URL
+ /// is used as a top-level navigation; /launch then sets the oc_auth cookie
+ /// and 302s into the proxied dashboard.
+ /// The user's bearer token is stashed in Redis under the token's jti and
+ /// retrieved (atomic GETDEL) on /launch redeem — this keeps the bearer out of
+ /// the URL and out of any signed payload while preserving the existing proxy
+ /// auth flow (oc_auth cookie value = bearer token).
+ /// Refuses instances whose agent_type has has_dashboard=False (e.g. hermes).
+ ///
+ ///
+ ///
+ /// 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 OpenclawLaunchTokenAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawLaunchTokenAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Launch Token
+ /// Mint a single-use launch URL for the dashboard.
+ /// Called by the launcher page right when readyz flips ready. The launch URL
+ /// is used as a top-level navigation; /launch then sets the oc_auth cookie
+ /// and 302s into the proxied dashboard.
+ /// The user's bearer token is stashed in Redis under the token's jti and
+ /// retrieved (atomic GETDEL) on /launch redeem — this keeps the bearer out of
+ /// the URL and out of any signed payload while preserving the existing proxy
+ /// auth flow (oc_auth cookie value = bearer token).
+ /// Refuses instances whose agent_type has has_dashboard=False (e.g. hermes).
+ ///
+ ///
+ ///
+ /// 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> OpenclawLaunchTokenAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawLaunchTokenArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawLaunchTokenSecurityRequirements,
+ operationName: "OpenclawLaunchTokenAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/launch_token",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawLaunchTokenRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawLaunchToken",
+ methodName: "OpenclawLaunchTokenAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/launch_token\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawLaunchToken",
+ methodName: "OpenclawLaunchTokenAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/launch_token\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawLaunchToken",
+ methodName: "OpenclawLaunchTokenAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/launch_token\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawLaunchTokenResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawLaunchToken",
+ methodName: "OpenclawLaunchTokenAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/launch_token\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawLaunchToken",
+ methodName: "OpenclawLaunchTokenAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/launch_token\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::DeepInfra.DeepError? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::DeepInfra.DeepError.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_400 = global::DeepInfra.DeepError.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ responseBody: __content_400,
+ responseObject: __value_400,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawLaunchTokenResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::DeepInfra.OpenClawLaunchTokenOut.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = await global::DeepInfra.OpenClawLaunchTokenOut.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawList.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawList.g.cs
new file mode 100644
index 00000000..1d530086
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawList.g.cs
@@ -0,0 +1,522 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawListSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawListSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawListSecurityRequirement0,
+ };
+ partial void PrepareOpenclawListArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref global::DeepInfra.OpenclawListV1AgentsGetState? state,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawListRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ global::DeepInfra.OpenclawListV1AgentsGetState? state,
+ string? xiApiKey);
+ partial void ProcessOpenclawListResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawListResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw List
+ ///
+ ///
+ /// Which instances to return: active, inactive, or all (both)
+ /// Default Value: active
+ ///
+ ///
+ /// 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> OpenclawListAsync(
+ global::DeepInfra.OpenclawListV1AgentsGetState? state = default,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawListAsResponseAsync(
+ state: state,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw List
+ ///
+ ///
+ /// Which instances to return: active, inactive, or all (both)
+ /// Default Value: active
+ ///
+ ///
+ /// 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>> OpenclawListAsResponseAsync(
+ global::DeepInfra.OpenclawListV1AgentsGetState? state = default,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawListArguments(
+ httpClient: HttpClient,
+ state: ref state,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawListSecurityRequirements,
+ operationName: "OpenclawListAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: "/v1/agents",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("state", state?.ToValueString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawListRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ state: state,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawList",
+ methodName: "OpenclawListAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawList",
+ methodName: "OpenclawListAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawList",
+ methodName: "OpenclawListAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawListResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawList",
+ methodName: "OpenclawListAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawList",
+ methodName: "OpenclawListAsync",
+ pathTemplate: "\"/v1/agents\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawListResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawListBackups.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawListBackups.g.cs
new file mode 100644
index 00000000..f100564e
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawListBackups.g.cs
@@ -0,0 +1,550 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawListBackupsSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawListBackupsSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawListBackupsSecurityRequirement0,
+ };
+ partial void PrepareOpenclawListBackupsArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawListBackupsRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawListBackupsResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawListBackupsResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw List Backups
+ ///
+ ///
+ ///
+ /// 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> OpenclawListBackupsAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawListBackupsAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw List Backups
+ ///
+ ///
+ ///
+ /// 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>> OpenclawListBackupsAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawListBackupsArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawListBackupsSecurityRequirements,
+ operationName: "OpenclawListBackupsAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/backups",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawListBackupsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawListBackups",
+ methodName: "OpenclawListBackupsAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawListBackups",
+ methodName: "OpenclawListBackupsAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawListBackups",
+ methodName: "OpenclawListBackupsAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawListBackupsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawListBackups",
+ methodName: "OpenclawListBackupsAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawListBackups",
+ methodName: "OpenclawListBackupsAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawListBackupsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = (global::System.Collections.Generic.IList?)global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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);
+
+ var __value = (global::System.Collections.Generic.IList?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(global::System.Collections.Generic.IList), JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::DeepInfra.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ 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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawRestoreBackup.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawRestoreBackup.g.cs
new file mode 100644
index 00000000..72e9f035
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawRestoreBackup.g.cs
@@ -0,0 +1,592 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawRestoreBackupSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawRestoreBackupSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawRestoreBackupSecurityRequirement0,
+ };
+ partial void PrepareOpenclawRestoreBackupArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string backupId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawRestoreBackupRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string backupId,
+ string? xiApiKey);
+ partial void ProcessOpenclawRestoreBackupResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawRestoreBackupResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Restore Backup
+ ///
+ ///
+ ///
+ ///
+ /// 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 OpenclawRestoreBackupAsync(
+ string instanceId,
+ string backupId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawRestoreBackupAsResponseAsync(
+ instanceId: instanceId,
+ backupId: backupId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Restore Backup
+ ///
+ ///
+ ///
+ ///
+ /// 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> OpenclawRestoreBackupAsResponseAsync(
+ string instanceId,
+ string backupId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawRestoreBackupArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ backupId: ref backupId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawRestoreBackupSecurityRequirements,
+ operationName: "OpenclawRestoreBackupAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/backups/{backupId}/restore",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawRestoreBackupRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ backupId: backupId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawRestoreBackup",
+ methodName: "OpenclawRestoreBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups/{backupId}/restore\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawRestoreBackup",
+ methodName: "OpenclawRestoreBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups/{backupId}/restore\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawRestoreBackup",
+ methodName: "OpenclawRestoreBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups/{backupId}/restore\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawRestoreBackupResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawRestoreBackup",
+ methodName: "OpenclawRestoreBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups/{backupId}/restore\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawRestoreBackup",
+ methodName: "OpenclawRestoreBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backups/{backupId}/restore\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawRestoreBackupResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStart.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStart.g.cs
new file mode 100644
index 00000000..f8fdb08f
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStart.g.cs
@@ -0,0 +1,583 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawStartSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawStartSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawStartSecurityRequirement0,
+ };
+ partial void PrepareOpenclawStartArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawStartRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawStartResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawStartResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Start
+ ///
+ ///
+ ///
+ /// 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 OpenclawStartAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawStartAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Start
+ ///
+ ///
+ ///
+ /// 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> OpenclawStartAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawStartArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawStartSecurityRequirements,
+ operationName: "OpenclawStartAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/start",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawStartRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStart",
+ methodName: "OpenclawStartAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/start\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStart",
+ methodName: "OpenclawStartAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/start\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStart",
+ methodName: "OpenclawStartAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/start\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawStartResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStart",
+ methodName: "OpenclawStartAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/start\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStart",
+ methodName: "OpenclawStartAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/start\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawStartResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStop.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStop.g.cs
new file mode 100644
index 00000000..b469cee6
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawStop.g.cs
@@ -0,0 +1,583 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawStopSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawStopSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawStopSecurityRequirement0,
+ };
+ partial void PrepareOpenclawStopArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawStopRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawStopResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawStopResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Stop
+ ///
+ ///
+ ///
+ /// 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 OpenclawStopAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawStopAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Stop
+ ///
+ ///
+ ///
+ /// 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> OpenclawStopAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawStopArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawStopSecurityRequirements,
+ operationName: "OpenclawStopAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/stop",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawStopRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStop",
+ methodName: "OpenclawStopAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/stop\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStop",
+ methodName: "OpenclawStopAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/stop\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStop",
+ methodName: "OpenclawStopAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/stop\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawStopResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStop",
+ methodName: "OpenclawStopAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/stop\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawStop",
+ methodName: "OpenclawStopAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/stop\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawStopResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawTriggerBackup.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawTriggerBackup.g.cs
new file mode 100644
index 00000000..80e8dffd
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawTriggerBackup.g.cs
@@ -0,0 +1,583 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawTriggerBackupSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawTriggerBackupSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawTriggerBackupSecurityRequirement0,
+ };
+ partial void PrepareOpenclawTriggerBackupArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawTriggerBackupRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawTriggerBackupResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawTriggerBackupResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Trigger Backup
+ ///
+ ///
+ ///
+ /// 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 OpenclawTriggerBackupAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawTriggerBackupAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Trigger Backup
+ ///
+ ///
+ ///
+ /// 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> OpenclawTriggerBackupAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawTriggerBackupArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawTriggerBackupSecurityRequirements,
+ operationName: "OpenclawTriggerBackupAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/backup",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawTriggerBackupRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawTriggerBackup",
+ methodName: "OpenclawTriggerBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backup\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawTriggerBackup",
+ methodName: "OpenclawTriggerBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backup\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawTriggerBackup",
+ methodName: "OpenclawTriggerBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backup\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawTriggerBackupResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawTriggerBackup",
+ methodName: "OpenclawTriggerBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backup\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawTriggerBackup",
+ methodName: "OpenclawTriggerBackupAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/backup\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawTriggerBackupResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdate.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdate.g.cs
new file mode 100644
index 00000000..7dc9eee0
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdate.g.cs
@@ -0,0 +1,596 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawUpdateSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawUpdateSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawUpdateSecurityRequirement0,
+ };
+ partial void PrepareOpenclawUpdateArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey,
+ global::DeepInfra.OpenClawUpdateIn request);
+ partial void PrepareOpenclawUpdateRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey,
+ global::DeepInfra.OpenClawUpdateIn request);
+ partial void ProcessOpenclawUpdateResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawUpdateResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Update
+ ///
+ ///
+ ///
+ ///
+ /// 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 OpenclawUpdateAsync(
+ string instanceId,
+
+ global::DeepInfra.OpenClawUpdateIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawUpdateAsResponseAsync(
+ instanceId: instanceId,
+
+ request: request,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Update
+ ///
+ ///
+ ///
+ ///
+ /// 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> OpenclawUpdateAsResponseAsync(
+ string instanceId,
+
+ global::DeepInfra.OpenClawUpdateIn request,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ request = request ?? throw new global::System.ArgumentNullException(nameof(request));
+
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawUpdateArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey,
+ request: request);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawUpdateSecurityRequirements,
+ operationName: "OpenclawUpdateAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ 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::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawUpdateRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdate",
+ methodName: "OpenclawUpdateAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdate",
+ methodName: "OpenclawUpdateAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdate",
+ methodName: "OpenclawUpdateAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawUpdateResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdate",
+ methodName: "OpenclawUpdateAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdate",
+ methodName: "OpenclawUpdateAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawUpdateResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ responseBody: __content,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Openclaw Update
+ ///
+ ///
+ ///
+ ///
+ /// Instance name
+ ///
+ /// 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 OpenclawUpdateAsync(
+ string instanceId,
+ string name,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __request = new global::DeepInfra.OpenClawUpdateIn
+ {
+ Name = name,
+ };
+
+ return await OpenclawUpdateAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ request: __request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken).ConfigureAwait(false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdateVersion.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdateVersion.g.cs
new file mode 100644
index 00000000..b6b11551
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.OpenclawUpdateVersion.g.cs
@@ -0,0 +1,583 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ public partial class AgentsClient
+ {
+
+
+ private static readonly global::DeepInfra.EndPointSecurityRequirement s_OpenclawUpdateVersionSecurityRequirement0 =
+ new global::DeepInfra.EndPointSecurityRequirement
+ {
+ Authorizations = new global::DeepInfra.EndPointAuthorizationRequirement[]
+ { new global::DeepInfra.EndPointAuthorizationRequirement
+ {
+ Type = "Http",
+ SchemeId = "HttpBearer",
+ Location = "Header",
+ Name = "Bearer",
+ FriendlyName = "Bearer",
+ },
+ },
+ };
+ private static readonly global::DeepInfra.EndPointSecurityRequirement[] s_OpenclawUpdateVersionSecurityRequirements =
+ new global::DeepInfra.EndPointSecurityRequirement[]
+ { s_OpenclawUpdateVersionSecurityRequirement0,
+ };
+ partial void PrepareOpenclawUpdateVersionArguments(
+ global::System.Net.Http.HttpClient httpClient,
+ ref string instanceId,
+ ref string? xiApiKey);
+ partial void PrepareOpenclawUpdateVersionRequest(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ string instanceId,
+ string? xiApiKey);
+ partial void ProcessOpenclawUpdateVersionResponse(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ partial void ProcessOpenclawUpdateVersionResponseContent(
+ global::System.Net.Http.HttpClient httpClient,
+ global::System.Net.Http.HttpResponseMessage httpResponseMessage,
+ ref string content);
+
+ ///
+ /// Openclaw Update Version
+ ///
+ ///
+ ///
+ /// 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 OpenclawUpdateVersionAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await OpenclawUpdateVersionAsResponseAsync(
+ instanceId: instanceId,
+ xiApiKey: xiApiKey,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Openclaw Update Version
+ ///
+ ///
+ ///
+ /// 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> OpenclawUpdateVersionAsResponseAsync(
+ string instanceId,
+ string? xiApiKey = default,
+ global::DeepInfra.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ PrepareArguments(
+ client: HttpClient);
+ PrepareOpenclawUpdateVersionArguments(
+ httpClient: HttpClient,
+ instanceId: ref instanceId,
+ xiApiKey: ref xiApiKey);
+
+
+ var __authorizations = global::DeepInfra.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_OpenclawUpdateVersionSecurityRequirements,
+ operationName: "OpenclawUpdateVersionAsync");
+
+ using var __timeoutCancellationTokenSource = global::DeepInfra.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::DeepInfra.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::DeepInfra.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::DeepInfra.PathBuilder(
+ path: $"/v1/agents/{instanceId}/update",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::DeepInfra.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;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ if (xiApiKey != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString());
+ }
+
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareOpenclawUpdateVersionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ instanceId: instanceId!,
+ xiApiKey: xiApiKey);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdateVersion",
+ methodName: "OpenclawUpdateVersionAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/update\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdateVersion",
+ methodName: "OpenclawUpdateVersionAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/update\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::DeepInfra.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::DeepInfra.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdateVersion",
+ methodName: "OpenclawUpdateVersionAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/update\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessOpenclawUpdateVersionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdateVersion",
+ methodName: "OpenclawUpdateVersionAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/update\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::DeepInfra.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::DeepInfra.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "OpenclawUpdateVersion",
+ methodName: "OpenclawUpdateVersionAsync",
+ pathTemplate: "$\"/v1/agents/{instanceId}/update\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::DeepInfra.DeepError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::DeepInfra.DeepError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ responseBody: __content_401,
+ responseObject: __value_401,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::DeepInfra.DeepError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::DeepInfra.DeepError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ responseBody: __content_404,
+ responseObject: __value_404,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
+ // Conflict
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::DeepInfra.DeepError? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_409 = global::DeepInfra.DeepError.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ 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::DeepInfra.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ responseBody: __content_422,
+ responseObject: __value_422,
+ 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);
+ ProcessOpenclawUpdateVersionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __content);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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 new global::DeepInfra.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::DeepInfra.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __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 global::DeepInfra.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ 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/DeepInfra/Generated/DeepInfra.AgentsClient.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.g.cs
new file mode 100644
index 00000000..7c91548b
--- /dev/null
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AgentsClient.g.cs
@@ -0,0 +1,137 @@
+
+#nullable enable
+
+namespace DeepInfra
+{
+ ///
+ /// Manage agent-framework instances (OpenClaw and friends).
+ /// 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.
+ ///
+ public sealed partial class AgentsClient : global::DeepInfra.IAgentsClient, global::System.IDisposable
+ {
+ ///
+ ///
+ ///
+ public const string DefaultBaseUrl = "https://api.deepinfra.com/";
+
+ private bool _disposeHttpClient = true;
+
+ ///
+ public global::System.Net.Http.HttpClient HttpClient { get; }
+
+ ///
+ public System.Uri? BaseUri => HttpClient.BaseAddress;
+
+ ///
+ public global::System.Collections.Generic.List Authorizations { get; }
+
+ ///
+ public bool ReadResponseAsString { get; set; }
+#if DEBUG
+ = true;
+#endif
+
+ ///
+ public global::DeepInfra.AutoSDKClientOptions Options { get; }
+ ///
+ ///
+ ///
+ public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::DeepInfra.SourceGenerationContext.Default;
+
+
+ ///
+ /// Creates a new instance of the AgentsClient.
+ /// 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.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public AgentsClient(
+ 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 AgentsClient with explicit options but no base URL override.
+ /// Skips passing baseUri so the default base URL from the OpenAPI spec applies.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// 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 AgentsClient(
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Collections.Generic.List? authorizations,
+ global::DeepInfra.AutoSDKClientOptions? options,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri: null,
+ authorizations,
+ options,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the AgentsClient.
+ /// 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 AgentsClient(
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::DeepInfra.AutoSDKClientOptions? options,
+ 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::DeepInfra.AutoSDKClientOptions();
+ _disposeHttpClient = disposeHttpClient;
+
+ Initialized(HttpClient);
+ }
+
+ ///
+ public void Dispose()
+ {
+ if (_disposeHttpClient)
+ {
+ HttpClient.Dispose();
+ }
+ }
+
+ partial void Initialized(
+ global::System.Net.Http.HttpClient client);
+ partial void PrepareArguments(
+ global::System.Net.Http.HttpClient client);
+ partial void PrepareRequest(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpRequestMessage request);
+ partial void ProcessResponse(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpResponseMessage response);
+ partial void ProcessResponseContent(
+ global::System.Net.Http.HttpClient client,
+ global::System.Net.Http.HttpResponseMessage response,
+ ref string content);
+ }
+}
\ No newline at end of file
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.2.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.2.g.cs
index d8950855..3f4a7e9b 100644
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.2.g.cs
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.2.g.cs
@@ -25,6 +25,26 @@ namespace DeepInfra
#endif
public bool IsValue1 => Value1 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue1(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T1? value)
+ {
+ value = Value1;
+ return IsValue1;
+ }
+
+ ///
+ ///
+ ///
+ public T1 PickValue1() => IsValue1
+ ? Value1!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");
+
///
///
///
@@ -41,6 +61,26 @@ namespace DeepInfra
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
#endif
public bool IsValue2 => Value2 != null;
+
+ ///
+ ///
+ ///
+ public bool TryPickValue2(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T2? value)
+ {
+ value = Value2;
+ return IsValue2;
+ }
+
+ ///
+ ///
+ ///
+ public T2 PickValue2() => IsValue2
+ ? Value2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
///
///
///
@@ -59,6 +99,11 @@ public AnyOf(T1? value)
Value1 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue1(T1? value) => new AnyOf(value);
+
///
///
///
@@ -77,6 +122,11 @@ public AnyOf(T2? value)
Value2 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue2(T2? value) => new AnyOf(value);
+
///
///
///
@@ -143,6 +193,30 @@ public bool Validate()
///
public void Match(
global::System.Action? value1 = null,
+
+ global::System.Action? value2 = null,
+ bool validate = true)
+ {
+ if (validate)
+ {
+ Validate();
+ }
+
+ if (IsValue1)
+ {
+ value1?.Invoke(Value1!);
+ }
+ else if (IsValue2)
+ {
+ value2?.Invoke(Value2!);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public void Switch(
+ global::System.Action? value1 = null,
global::System.Action? value2 = null,
bool validate = true)
{
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.3.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.3.g.cs
index 1b628e9c..2ce7efb8 100644
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.3.g.cs
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.3.g.cs
@@ -25,6 +25,26 @@ namespace DeepInfra
#endif
public bool IsValue1 => Value1 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue1(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T1? value)
+ {
+ value = Value1;
+ return IsValue1;
+ }
+
+ ///
+ ///
+ ///
+ public T1 PickValue1() => IsValue1
+ ? Value1!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");
+
///
///
///
@@ -42,6 +62,26 @@ namespace DeepInfra
#endif
public bool IsValue2 => Value2 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue2(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T2? value)
+ {
+ value = Value2;
+ return IsValue2;
+ }
+
+ ///
+ ///
+ ///
+ public T2 PickValue2() => IsValue2
+ ? Value2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
+
///
///
///
@@ -58,6 +98,26 @@ namespace DeepInfra
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value3))]
#endif
public bool IsValue3 => Value3 != null;
+
+ ///
+ ///
+ ///
+ public bool TryPickValue3(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T3? value)
+ {
+ value = Value3;
+ return IsValue3;
+ }
+
+ ///
+ ///
+ ///
+ public T3 PickValue3() => IsValue3
+ ? Value3!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}.");
///
///
///
@@ -76,6 +136,11 @@ public AnyOf(T1? value)
Value1 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue1(T1? value) => new AnyOf(value);
+
///
///
///
@@ -94,6 +159,11 @@ public AnyOf(T2? value)
Value2 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue2(T2? value) => new AnyOf(value);
+
///
///
///
@@ -112,6 +182,11 @@ public AnyOf(T3? value)
Value3 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue3(T3? value) => new AnyOf(value);
+
///
///
///
@@ -187,6 +262,36 @@ public bool Validate()
///
public void Match(
global::System.Action? value1 = null,
+
+ global::System.Action? value2 = null,
+
+ global::System.Action? value3 = null,
+ bool validate = true)
+ {
+ if (validate)
+ {
+ Validate();
+ }
+
+ if (IsValue1)
+ {
+ value1?.Invoke(Value1!);
+ }
+ else if (IsValue2)
+ {
+ value2?.Invoke(Value2!);
+ }
+ else if (IsValue3)
+ {
+ value3?.Invoke(Value3!);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public void Switch(
+ global::System.Action? value1 = null,
global::System.Action? value2 = null,
global::System.Action? value3 = null,
bool validate = true)
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.4.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.4.g.cs
index e3ca5bbd..8cc3f9ec 100644
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.4.g.cs
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.4.g.cs
@@ -25,6 +25,26 @@ namespace DeepInfra
#endif
public bool IsValue1 => Value1 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue1(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T1? value)
+ {
+ value = Value1;
+ return IsValue1;
+ }
+
+ ///
+ ///
+ ///
+ public T1 PickValue1() => IsValue1
+ ? Value1!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");
+
///
///
///
@@ -42,6 +62,26 @@ namespace DeepInfra
#endif
public bool IsValue2 => Value2 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue2(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T2? value)
+ {
+ value = Value2;
+ return IsValue2;
+ }
+
+ ///
+ ///
+ ///
+ public T2 PickValue2() => IsValue2
+ ? Value2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
+
///
///
///
@@ -59,6 +99,26 @@ namespace DeepInfra
#endif
public bool IsValue3 => Value3 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue3(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T3? value)
+ {
+ value = Value3;
+ return IsValue3;
+ }
+
+ ///
+ ///
+ ///
+ public T3 PickValue3() => IsValue3
+ ? Value3!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}.");
+
///
///
///
@@ -75,6 +135,26 @@ namespace DeepInfra
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value4))]
#endif
public bool IsValue4 => Value4 != null;
+
+ ///
+ ///
+ ///
+ public bool TryPickValue4(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T4? value)
+ {
+ value = Value4;
+ return IsValue4;
+ }
+
+ ///
+ ///
+ ///
+ public T4 PickValue4() => IsValue4
+ ? Value4!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value4' but the value was {ToString()}.");
///
///
///
@@ -93,6 +173,11 @@ public AnyOf(T1? value)
Value1 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue1(T1? value) => new AnyOf(value);
+
///
///
///
@@ -111,6 +196,11 @@ public AnyOf(T2? value)
Value2 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue2(T2? value) => new AnyOf(value);
+
///
///
///
@@ -129,6 +219,11 @@ public AnyOf(T3? value)
Value3 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue3(T3? value) => new AnyOf(value);
+
///
///
///
@@ -147,6 +242,11 @@ public AnyOf(T4? value)
Value4 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue4(T4? value) => new AnyOf(value);
+
///
///
///
@@ -231,6 +331,42 @@ public bool Validate()
///
public void Match(
global::System.Action? value1 = null,
+
+ global::System.Action? value2 = null,
+
+ global::System.Action? value3 = null,
+
+ global::System.Action? value4 = null,
+ bool validate = true)
+ {
+ if (validate)
+ {
+ Validate();
+ }
+
+ if (IsValue1)
+ {
+ value1?.Invoke(Value1!);
+ }
+ else if (IsValue2)
+ {
+ value2?.Invoke(Value2!);
+ }
+ else if (IsValue3)
+ {
+ value3?.Invoke(Value3!);
+ }
+ else if (IsValue4)
+ {
+ value4?.Invoke(Value4!);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public void Switch(
+ global::System.Action? value1 = null,
global::System.Action? value2 = null,
global::System.Action? value3 = null,
global::System.Action? value4 = null,
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.5.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.5.g.cs
index 77f3bd98..b780455c 100644
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.5.g.cs
+++ b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.5.g.cs
@@ -25,6 +25,26 @@ namespace DeepInfra
#endif
public bool IsValue1 => Value1 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue1(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T1? value)
+ {
+ value = Value1;
+ return IsValue1;
+ }
+
+ ///
+ ///
+ ///
+ public T1 PickValue1() => IsValue1
+ ? Value1!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value1' but the value was {ToString()}.");
+
///
///
///
@@ -42,6 +62,26 @@ namespace DeepInfra
#endif
public bool IsValue2 => Value2 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue2(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T2? value)
+ {
+ value = Value2;
+ return IsValue2;
+ }
+
+ ///
+ ///
+ ///
+ public T2 PickValue2() => IsValue2
+ ? Value2!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value2' but the value was {ToString()}.");
+
///
///
///
@@ -59,6 +99,26 @@ namespace DeepInfra
#endif
public bool IsValue3 => Value3 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue3(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T3? value)
+ {
+ value = Value3;
+ return IsValue3;
+ }
+
+ ///
+ ///
+ ///
+ public T3 PickValue3() => IsValue3
+ ? Value3!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value3' but the value was {ToString()}.");
+
///
///
///
@@ -76,6 +136,26 @@ namespace DeepInfra
#endif
public bool IsValue4 => Value4 != null;
+ ///
+ ///
+ ///
+ public bool TryPickValue4(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T4? value)
+ {
+ value = Value4;
+ return IsValue4;
+ }
+
+ ///
+ ///
+ ///
+ public T4 PickValue4() => IsValue4
+ ? Value4!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value4' but the value was {ToString()}.");
+
///
///
///
@@ -92,6 +172,26 @@ namespace DeepInfra
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value5))]
#endif
public bool IsValue5 => Value5 != null;
+
+ ///
+ ///
+ ///
+ public bool TryPickValue5(
+#if NET6_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)]
+#endif
+ out T5? value)
+ {
+ value = Value5;
+ return IsValue5;
+ }
+
+ ///
+ ///
+ ///
+ public T5 PickValue5() => IsValue5
+ ? Value5!
+ : throw new global::System.InvalidOperationException($"Expected union variant 'Value5' but the value was {ToString()}.");
///
///
///
@@ -110,6 +210,11 @@ public AnyOf(T1? value)
Value1 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue1(T1? value) => new AnyOf(value);
+
///
///
///
@@ -128,6 +233,11 @@ public AnyOf(T2? value)
Value2 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue2(T2? value) => new AnyOf(value);
+
///
///
///
@@ -146,6 +256,11 @@ public AnyOf(T3? value)
Value3 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue3(T3? value) => new AnyOf(value);
+
///
///
///
@@ -164,6 +279,11 @@ public AnyOf(T4? value)
Value4 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue4(T4? value) => new AnyOf(value);
+
///
///
///
@@ -182,6 +302,11 @@ public AnyOf(T5? value)
Value5 = value;
}
+ ///
+ ///
+ ///
+ public static AnyOf FromValue5(T5? value) => new AnyOf(value);
+
///
///
///
@@ -275,6 +400,48 @@ public bool Validate()
///
public void Match(
global::System.Action? value1 = null,
+
+ global::System.Action? value2 = null,
+
+ global::System.Action? value3 = null,
+
+ global::System.Action? value4 = null,
+
+ global::System.Action? value5 = null,
+ bool validate = true)
+ {
+ if (validate)
+ {
+ Validate();
+ }
+
+ if (IsValue1)
+ {
+ value1?.Invoke(Value1!);
+ }
+ else if (IsValue2)
+ {
+ value2?.Invoke(Value2!);
+ }
+ else if (IsValue3)
+ {
+ value3?.Invoke(Value3!);
+ }
+ else if (IsValue4)
+ {
+ value4?.Invoke(Value4!);
+ }
+ else if (IsValue5)
+ {
+ value5?.Invoke(Value5!);
+ }
+ }
+
+ ///
+ ///
+ ///
+ public void Switch(
+ global::System.Action? value1 = null,
global::System.Action? value2 = null,
global::System.Action? value3 = null,
global::System.Action? value4 = null,
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.Json.g.cs
deleted file mode 100644
index 3d365af6..00000000
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.Json.g.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-#nullable enable
-
-namespace DeepInfra
-{
- public readonly partial struct AnyOf
- {
- ///
- /// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
- ///
- public string ToJson(
- global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
- {
- return global::System.Text.Json.JsonSerializer.Serialize(
- this,
- this.GetType(),
- jsonSerializerContext);
- }
-
- ///
- /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
- ///
-#if NET8_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
- [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
-#endif
- public string ToJson(
- global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
- {
- return global::System.Text.Json.JsonSerializer.Serialize(
- this,
- jsonSerializerOptions);
- }
-
- ///
- /// Deserializes a JSON string using the provided JsonSerializerContext.
- ///
- public static global::DeepInfra.AnyOf? FromJson(
- string json,
- global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
- {
- return global::System.Text.Json.JsonSerializer.Deserialize(
- json,
- typeof(global::DeepInfra.AnyOf),
- jsonSerializerContext) as global::DeepInfra.AnyOf?;
- }
-
- ///
- /// Deserializes a JSON string using the provided JsonSerializerOptions.
- ///
-#if NET8_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
- [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
-#endif
- public static global::DeepInfra.AnyOf? FromJson(
- string json,
- global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
- {
- return global::System.Text.Json.JsonSerializer.Deserialize>(
- json,
- jsonSerializerOptions);
- }
-
- ///
- /// Deserializes a JSON stream using the provided JsonSerializerContext.
- ///
- public static async global::System.Threading.Tasks.ValueTask?> FromJsonStreamAsync(
- global::System.IO.Stream jsonStream,
- global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
- {
- return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
- jsonStream,
- typeof(global::DeepInfra.AnyOf),
- jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.AnyOf?;
- }
-
- ///
- /// Deserializes a JSON stream using the provided JsonSerializerOptions.
- ///
-#if NET8_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
- [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
-#endif
- public static global::System.Threading.Tasks.ValueTask?> FromJsonStreamAsync(
- global::System.IO.Stream jsonStream,
- global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
- {
- return global::System.Text.Json.JsonSerializer.DeserializeAsync?>(
- jsonStream,
- jsonSerializerOptions);
- }
- }
-}
diff --git a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.g.cs
deleted file mode 100644
index 57f5215f..00000000
--- a/src/libs/DeepInfra/Generated/DeepInfra.AnyOf.8.g.cs
+++ /dev/null
@@ -1,532 +0,0 @@
-
-#nullable enable
-
-namespace DeepInfra
-{
- ///
- ///
- ///
- public readonly partial struct AnyOf : global::System.IEquatable>
- {
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T1? Value1 { get; init; }
-#else
- public T1? Value1 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))]
-#endif
- public bool IsValue1 => Value1 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T2? Value2 { get; init; }
-#else
- public T2? Value2 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
-#endif
- public bool IsValue2 => Value2 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T3? Value3 { get; init; }
-#else
- public T3? Value3 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value3))]
-#endif
- public bool IsValue3 => Value3 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T4? Value4 { get; init; }
-#else
- public T4? Value4 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value4))]
-#endif
- public bool IsValue4 => Value4 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T5? Value5 { get; init; }
-#else
- public T5? Value5 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value5))]
-#endif
- public bool IsValue5 => Value5 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T6? Value6 { get; init; }
-#else
- public T6? Value6 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value6))]
-#endif
- public bool IsValue6 => Value6 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T7? Value7 { get; init; }
-#else
- public T7? Value7 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value7))]
-#endif
- public bool IsValue7 => Value7 != null;
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- public T8? Value8 { get; init; }
-#else
- public T8? Value8 { get; }
-#endif
-
- ///
- ///
- ///
-#if NET6_0_OR_GREATER
- [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value8))]
-#endif
- public bool IsValue8 => Value8 != null;
- ///
- ///
- ///
- public static implicit operator AnyOf(T1 value) => new AnyOf((T1?)value);
-
- ///
- ///
- ///
- public static implicit operator T1?(AnyOf @this) => @this.Value1;
-
- ///