From 685d3e0b32a857232d400fa3b96eecefc6c6e50b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 25 Aug 2026 01:34:05 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ...ravox.AgentsClient.AgentsTelephonyXml.g.cs | 8 +- ...x.ISchemaClient.SchemaRetrieveAsBytes.g.cs | 53 ++ ...Ultravox.IToolsClient.ToolsTestCreate.g.cs | 22 +- .../Ultravox.SchemaClient.SchemaRetrieve.g.cs | 4 + ...ox.SchemaClient.SchemaRetrieveAsBytes.g.cs | 765 ++++++++++++++++++ .../Ultravox.ToolsClient.ToolsTestCreate.g.cs | 398 ++++++++- 6 files changed, 1224 insertions(+), 26 deletions(-) create mode 100644 src/libs/Ultravox/Generated/Ultravox.ISchemaClient.SchemaRetrieveAsBytes.g.cs create mode 100644 src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieveAsBytes.g.cs diff --git a/src/libs/Ultravox/Generated/Ultravox.AgentsClient.AgentsTelephonyXml.g.cs b/src/libs/Ultravox/Generated/Ultravox.AgentsClient.AgentsTelephonyXml.g.cs index f739ce2..87e6116 100644 --- a/src/libs/Ultravox/Generated/Ultravox.AgentsClient.AgentsTelephonyXml.g.cs +++ b/src/libs/Ultravox/Generated/Ultravox.AgentsClient.AgentsTelephonyXml.g.cs @@ -147,12 +147,10 @@ partial void ProcessAgentsTelephonyXmlResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); - var __httpRequestContent = new global::System.Net.Http.StringContent( - content: __httpRequestContentBody, - encoding: global::System.Text.Encoding.UTF8, - mediaType: "application/x-www-form-urlencoded"); + var __formValues = new global::System.Collections.Generic.List>(); + var __httpRequestContent = new global::System.Net.Http.FormUrlEncodedContent(__formValues); __httpRequest.Content = __httpRequestContent; + global::Ultravox.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, diff --git a/src/libs/Ultravox/Generated/Ultravox.ISchemaClient.SchemaRetrieveAsBytes.g.cs b/src/libs/Ultravox/Generated/Ultravox.ISchemaClient.SchemaRetrieveAsBytes.g.cs new file mode 100644 index 0000000..ce170eb --- /dev/null +++ b/src/libs/Ultravox/Generated/Ultravox.ISchemaClient.SchemaRetrieveAsBytes.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ultravox +{ + public partial interface ISchemaClient + { + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task SchemaRetrieveAsBytesAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task SchemaRetrieveAsBytesAsStreamAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> SchemaRetrieveAsBytesAsResponseAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ultravox/Generated/Ultravox.IToolsClient.ToolsTestCreate.g.cs b/src/libs/Ultravox/Generated/Ultravox.IToolsClient.ToolsTestCreate.g.cs index 7b265f0..19968a5 100644 --- a/src/libs/Ultravox/Generated/Ultravox.IToolsClient.ToolsTestCreate.g.cs +++ b/src/libs/Ultravox/Generated/Ultravox.IToolsClient.ToolsTestCreate.g.cs @@ -14,7 +14,7 @@ public partial interface IToolsClient /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ToolsTestCreateAsync( + global::System.Threading.Tasks.Task ToolsTestCreateAsync( global::System.Guid toolId, global::Ultravox.ToolsTestCreateRequest request, @@ -30,7 +30,23 @@ public partial interface IToolsClient /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task> ToolsTestCreateAsResponseAsync( + global::System.Threading.Tasks.Task ToolsTestCreateAsStreamAsync( + global::System.Guid toolId, + + global::Ultravox.ToolsTestCreateRequest request, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Test a tool by executing it with the provided parameters.
+ /// Every property other than `authTokens` is treated as a value for one of the tool's dynamic parameters, matched by parameter name and sent in whichever location that parameter declares (query, path, header, or body). Properties that don't match a dynamic parameter are ignored. The tool's static and automatic parameters are filled in automatically, so they should not be supplied here.
+ /// Only HTTP tools can be tested. Tools requiring an Ultravox call token are rejected, since no call exists to issue one against. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ToolsTestCreateAsResponseAsync( global::System.Guid toolId, global::Ultravox.ToolsTestCreateRequest request, @@ -49,7 +65,7 @@ public partial interface IToolsClient /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// - global::System.Threading.Tasks.Task ToolsTestCreateAsync( + global::System.Threading.Tasks.Task ToolsTestCreateAsync( global::System.Guid toolId, global::System.Collections.Generic.Dictionary? authTokens = default, global::Ultravox.AutoSDKRequestOptions? requestOptions = default, diff --git a/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieve.g.cs b/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieve.g.cs index 06c84ed..bdcc0a7 100644 --- a/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieve.g.cs +++ b/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieve.g.cs @@ -134,6 +134,10 @@ partial void ProcessSchemaRetrieveResponseContent( __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; #endif + __httpRequest.Headers.TryAddWithoutValidation( + "Accept", + "application/vnd.oai.openapi+json"); + foreach (var __authorization in __authorizations) { if (__authorization.Type == "Http" || diff --git a/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieveAsBytes.g.cs b/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieveAsBytes.g.cs new file mode 100644 index 0000000..4d6e641 --- /dev/null +++ b/src/libs/Ultravox/Generated/Ultravox.SchemaClient.SchemaRetrieveAsBytes.g.cs @@ -0,0 +1,765 @@ + +#nullable enable + +namespace Ultravox +{ + public partial class SchemaClient + { + + + private static readonly global::Ultravox.EndPointSecurityRequirement s_SchemaRetrieveAsBytesSecurityRequirement0 = + new global::Ultravox.EndPointSecurityRequirement + { + Authorizations = new global::Ultravox.EndPointAuthorizationRequirement[] + { new global::Ultravox.EndPointAuthorizationRequirement + { + Type = "ApiKey", + SchemeId = "ApikeyXApiKey", + Location = "Header", + Name = "X-API-Key", + FriendlyName = "ApiKeyInHeader", + }, + }, + }; + private static readonly global::Ultravox.EndPointSecurityRequirement[] s_SchemaRetrieveAsBytesSecurityRequirements = + new global::Ultravox.EndPointSecurityRequirement[] + { s_SchemaRetrieveAsBytesSecurityRequirement0, + }; + partial void PrepareSchemaRetrieveAsBytesArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::Ultravox.SchemaRetrieveFormat? format, + ref global::Ultravox.SchemaRetrieveLang? lang); + partial void PrepareSchemaRetrieveAsBytesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::Ultravox.SchemaRetrieveFormat? format, + global::Ultravox.SchemaRetrieveLang? lang); + partial void ProcessSchemaRetrieveAsBytesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessSchemaRetrieveAsBytesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref byte[] content); + + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// 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 SchemaRetrieveAsBytesAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SchemaRetrieveAsBytesAsResponseAsync( + format: format, + lang: lang, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// 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 SchemaRetrieveAsBytesAsStreamAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareSchemaRetrieveAsBytesArguments( + httpClient: HttpClient, + format: ref format, + lang: ref lang); + + + var __authorizations = global::Ultravox.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_SchemaRetrieveAsBytesSecurityRequirements, + operationName: "SchemaRetrieveAsBytesAsync"); + + using var __timeoutCancellationTokenSource = global::Ultravox.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ultravox.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ultravox.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ultravox.PathBuilder( + path: "/api/schema/", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("format", format?.ToValueString()) + .AddOptionalParameter("lang", lang?.ToValueString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ultravox.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 + + __httpRequest.Headers.TryAddWithoutValidation( + "Accept", + "application/vnd.oai.openapi"); + + 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); + } + } + global::Ultravox.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSchemaRetrieveAsBytesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + format: format, + lang: lang); + + 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::Ultravox.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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.ResponseHeadersRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ultravox.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + try + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessSchemaRetrieveAsBytesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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); + } + + try + { + __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return new global::Ultravox.ResponseStream(__response, __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::Ultravox.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)); + } + + } + catch + { + __response.Dispose(); + throw; + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// OpenApi3 schema for this API. Format can be selected via content negotiation.
+ /// - YAML: application/vnd.oai.openapi
+ /// - JSON: application/vnd.oai.openapi+json + ///
+ /// + /// + /// 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> SchemaRetrieveAsBytesAsResponseAsync( + global::Ultravox.SchemaRetrieveFormat? format = default, + global::Ultravox.SchemaRetrieveLang? lang = default, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareSchemaRetrieveAsBytesArguments( + httpClient: HttpClient, + format: ref format, + lang: ref lang); + + + var __authorizations = global::Ultravox.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_SchemaRetrieveAsBytesSecurityRequirements, + operationName: "SchemaRetrieveAsBytesAsync"); + + using var __timeoutCancellationTokenSource = global::Ultravox.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ultravox.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ultravox.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ultravox.PathBuilder( + path: "/api/schema/", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("format", format?.ToValueString()) + .AddOptionalParameter("lang", lang?.ToValueString()) + ; + var __path = __pathBuilder.ToString(); + __path = global::Ultravox.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 + + __httpRequest.Headers.TryAddWithoutValidation( + "Accept", + "application/vnd.oai.openapi"); + + 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); + } + } + global::Ultravox.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSchemaRetrieveAsBytesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + format: format, + lang: lang); + + 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::Ultravox.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ultravox.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.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); + ProcessSchemaRetrieveAsBytesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SchemaRetrieveAsBytes", + methodName: "SchemaRetrieveAsBytesAsync", + pathTemplate: "\"/api/schema/\"", + 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); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsByteArrayAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessSchemaRetrieveAsBytesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return new global::Ultravox.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ultravox.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); + } + catch (global::System.Exception __ex) + { + throw global::Ultravox.ApiException.Create( + statusCode: __response.StatusCode, + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: null, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + var __content = await __response.Content.ReadAsByteArrayAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return new global::Ultravox.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Ultravox.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::Ultravox.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/Ultravox/Generated/Ultravox.ToolsClient.ToolsTestCreate.g.cs b/src/libs/Ultravox/Generated/Ultravox.ToolsClient.ToolsTestCreate.g.cs index 09c683c..c08699c 100644 --- a/src/libs/Ultravox/Generated/Ultravox.ToolsClient.ToolsTestCreate.g.cs +++ b/src/libs/Ultravox/Generated/Ultravox.ToolsClient.ToolsTestCreate.g.cs @@ -41,7 +41,7 @@ partial void ProcessToolsTestCreateResponse( partial void ProcessToolsTestCreateResponseContent( global::System.Net.Http.HttpClient httpClient, global::System.Net.Http.HttpResponseMessage httpResponseMessage, - ref string content); + ref byte[] content); /// /// Test a tool by executing it with the provided parameters.
@@ -53,7 +53,7 @@ partial void ProcessToolsTestCreateResponseContent( /// 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 ToolsTestCreateAsync( + public async global::System.Threading.Tasks.Task ToolsTestCreateAsync( global::System.Guid toolId, global::Ultravox.ToolsTestCreateRequest request, @@ -80,7 +80,373 @@ partial void ProcessToolsTestCreateResponseContent( /// 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> ToolsTestCreateAsResponseAsync( + public async global::System.Threading.Tasks.Task ToolsTestCreateAsStreamAsync( + global::System.Guid toolId, + + global::Ultravox.ToolsTestCreateRequest request, + global::Ultravox.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareToolsTestCreateArguments( + httpClient: HttpClient, + toolId: ref toolId, + request: request); + + + var __authorizations = global::Ultravox.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ToolsTestCreateSecurityRequirements, + operationName: "ToolsTestCreateAsync"); + + using var __timeoutCancellationTokenSource = global::Ultravox.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Ultravox.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Ultravox.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Ultravox.PathBuilder( + path: $"/api/tools/{toolId}/test", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + __path = global::Ultravox.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); + } + } + 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::Ultravox.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareToolsTestCreateRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + toolId: toolId!, + 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::Ultravox.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToolsTestCreate", + methodName: "ToolsTestCreateAsync", + pathTemplate: "$\"/api/tools/{toolId}/test\"", + 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.ResponseHeadersRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToolsTestCreate", + methodName: "ToolsTestCreateAsync", + pathTemplate: "$\"/api/tools/{toolId}/test\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Ultravox.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Ultravox.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToolsTestCreate", + methodName: "ToolsTestCreateAsync", + pathTemplate: "$\"/api/tools/{toolId}/test\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + try + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessToolsTestCreateResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Ultravox.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToolsTestCreate", + methodName: "ToolsTestCreateAsync", + pathTemplate: "$\"/api/tools/{toolId}/test\"", + 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::Ultravox.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Ultravox.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ToolsTestCreate", + methodName: "ToolsTestCreateAsync", + pathTemplate: "$\"/api/tools/{toolId}/test\"", + 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); + } + // + if (!__response.IsSuccessStatusCode) + { + string? __content_default = null; + global::System.Exception? __exception_default = null; + byte[]? __value_default = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_default = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + __value_default = (byte[]?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(byte[]), JsonSerializerContext); + } + else + { + __content_default = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + + __value_default = (byte[]?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(byte[]), JsonSerializerContext); + } + } + catch (global::System.Exception __ex) + { + __exception_default = __ex; + } + + + throw global::Ultravox.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_default ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_default, + responseBody: __content_default, + responseObject: __value_default, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + try + { + __response.EnsureSuccessStatusCode(); + + var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + return new global::Ultravox.ResponseStream(__response, __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::Ultravox.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)); + } + + } + catch + { + __response.Dispose(); + throw; + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Test a tool by executing it with the provided parameters.
+ /// Every property other than `authTokens` is treated as a value for one of the tool's dynamic parameters, matched by parameter name and sent in whichever location that parameter declares (query, path, header, or body). Properties that don't match a dynamic parameter are ignored. The tool's static and automatic parameters are filled in automatically, so they should not be supplied here.
+ /// Only HTTP tools can be tested. Tools requiring an Ultravox call token are rejected, since no call exists to issue one against. + ///
+ /// + /// + /// 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> ToolsTestCreateAsResponseAsync( global::System.Guid toolId, global::Ultravox.ToolsTestCreateRequest request, @@ -353,19 +719,19 @@ partial void ProcessToolsTestCreateResponseContent( { string? __content_default = null; global::System.Exception? __exception_default = null; - string? __value_default = null; + byte[]? __value_default = null; try { if (__effectiveReadResponseAsString) { __content_default = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_default = (string?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(string), JsonSerializerContext); + __value_default = (byte[]?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(byte[]), JsonSerializerContext); } else { __content_default = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); - __value_default = (string?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(string), JsonSerializerContext); + __value_default = (byte[]?)global::System.Text.Json.JsonSerializer.Deserialize(__content_default, typeof(byte[]), JsonSerializerContext); } } catch (global::System.Exception __ex) @@ -374,7 +740,7 @@ partial void ProcessToolsTestCreateResponseContent( } - throw global::Ultravox.ApiException.Create( + throw global::Ultravox.ApiException.Create( statusCode: __response.StatusCode, message: __content_default ?? __response.ReasonPhrase ?? string.Empty, innerException: __exception_default, @@ -388,16 +754,12 @@ partial void ProcessToolsTestCreateResponseContent( if (__effectiveReadResponseAsString) { - var __content = await __response.Content.ReadAsStringAsync( + var __content = await __response.Content.ReadAsByteArrayAsync( #if NET5_0_OR_GREATER __effectiveCancellationToken #endif ).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); ProcessToolsTestCreateResponseContent( httpClient: HttpClient, httpResponseMessage: __response, @@ -407,7 +769,7 @@ partial void ProcessToolsTestCreateResponseContent( { __response.EnsureSuccessStatusCode(); - return new global::Ultravox.AutoSDKHttpResponse( + return new global::Ultravox.AutoSDKHttpResponse( statusCode: __response.StatusCode, headers: global::Ultravox.AutoSDKHttpResponse.CreateHeaders(__response), requestUri: __response.RequestMessage?.RequestUri, @@ -417,9 +779,9 @@ partial void ProcessToolsTestCreateResponseContent( { throw global::Ultravox.ApiException.Create( statusCode: __response.StatusCode, - message: __content ?? __response.ReasonPhrase ?? string.Empty, + message: __response.ReasonPhrase ?? string.Empty, innerException: __ex, - responseBody: __content, + responseBody: null, responseHeaders: global::System.Linq.Enumerable.ToDictionary( __response.Headers, h => h.Key, @@ -431,13 +793,13 @@ partial void ProcessToolsTestCreateResponseContent( try { __response.EnsureSuccessStatusCode(); - var __content = await __response.Content.ReadAsStringAsync( + var __content = await __response.Content.ReadAsByteArrayAsync( #if NET5_0_OR_GREATER __effectiveCancellationToken #endif ).ConfigureAwait(false); - return new global::Ultravox.AutoSDKHttpResponse( + return new global::Ultravox.AutoSDKHttpResponse( statusCode: __response.StatusCode, headers: global::Ultravox.AutoSDKHttpResponse.CreateHeaders(__response), requestUri: __response.RequestMessage?.RequestUri, @@ -490,7 +852,7 @@ partial void ProcessToolsTestCreateResponseContent( /// 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 ToolsTestCreateAsync( + public async global::System.Threading.Tasks.Task ToolsTestCreateAsync( global::System.Guid toolId, global::System.Collections.Generic.Dictionary? authTokens = default, global::Ultravox.AutoSDKRequestOptions? requestOptions = default,