< Summary

Class:Azure.Search.Documents.DocumentsRestClient
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\DocumentsRestClient.cs
Covered lines:131
Uncovered lines:115
Coverable lines:246
Total lines:532
Line coverage:53.2% (131 of 246)
Covered branches:20
Total branches:72
Branch coverage:27.7% (20 of 72)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-78.57%50%
CreateCountRequest()-93.33%50%
CountAsync()-100%100%
Count(...)-100%100%
CreateSearchPostRequest(...)-94.74%50%
SearchPostAsync()-0%0%
SearchPost(...)-0%0%
CreateGetRequest(...)-94.74%75%
GetAsync()-0%0%
Get(...)-0%0%
CreateSuggestPostRequest(...)-94.74%50%
SuggestPostAsync()-0%0%
SuggestPost(...)-0%0%
CreateIndexRequest(...)-0%0%
IndexAsync()-0%0%
Index(...)-0%0%
CreateAutocompletePostRequest(...)-94.74%50%
AutocompletePostAsync()-90%75%
AutocompletePost(...)-90%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\DocumentsRestClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using System.Threading;
 12using System.Threading.Tasks;
 13using Azure;
 14using Azure.Core;
 15using Azure.Core.Pipeline;
 16using Azure.Search.Documents.Models;
 17
 18namespace Azure.Search.Documents
 19{
 20    internal partial class DocumentsRestClient
 21    {
 22        private string endpoint;
 23        private string indexName;
 24        private Guid? xMsClientRequestId;
 25        private string apiVersion;
 26        private ClientDiagnostics _clientDiagnostics;
 27        private HttpPipeline _pipeline;
 28
 29        /// <summary> Initializes a new instance of DocumentsRestClient. </summary>
 30        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 31        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 32        /// <param name="endpoint"> The endpoint URL of the search service. </param>
 33        /// <param name="indexName"> The name of the index. </param>
 34        /// <param name="xMsClientRequestId"> The tracking ID sent with the request to help with debugging. </param>
 35        /// <param name="apiVersion"> Api Version. </param>
 36        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="indexName"/>, or <para
 24837        public DocumentsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string i
 38        {
 24839            if (endpoint == null)
 40            {
 041                throw new ArgumentNullException(nameof(endpoint));
 42            }
 24843            if (indexName == null)
 44            {
 045                throw new ArgumentNullException(nameof(indexName));
 46            }
 24847            if (apiVersion == null)
 48            {
 049                throw new ArgumentNullException(nameof(apiVersion));
 50            }
 51
 24852            this.endpoint = endpoint;
 24853            this.indexName = indexName;
 24854            this.xMsClientRequestId = xMsClientRequestId;
 24855            this.apiVersion = apiVersion;
 24856            _clientDiagnostics = clientDiagnostics;
 24857            _pipeline = pipeline;
 24858        }
 59
 60        internal HttpMessage CreateCountRequest()
 61        {
 4062            var message = _pipeline.CreateMessage();
 4063            var request = message.Request;
 4064            request.Method = RequestMethod.Get;
 4065            var uri = new RawRequestUriBuilder();
 4066            uri.AppendRaw(endpoint, false);
 4067            uri.AppendRaw("/indexes('", false);
 4068            uri.AppendRaw(indexName, true);
 4069            uri.AppendRaw("')", false);
 4070            uri.AppendPath("/docs/$count", false);
 4071            uri.AppendQuery("api-version", apiVersion, true);
 4072            request.Uri = uri;
 4073            if (xMsClientRequestId != null)
 74            {
 075                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 76            }
 4077            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 4078            return message;
 79        }
 80
 81        /// <summary> Queries the number of documents in the index. </summary>
 82        /// <param name="cancellationToken"> The cancellation token to use. </param>
 83        public async Task<Response<long>> CountAsync(CancellationToken cancellationToken = default)
 84        {
 2085            using var message = CreateCountRequest();
 2086            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2087            switch (message.Response.Status)
 88            {
 89                case 200:
 90                    {
 91                        long value = default;
 1992                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 1993                        value = document.RootElement.GetInt64();
 1994                        return Response.FromValue(value, message.Response);
 95                    }
 96                default:
 197                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 98            }
 1999        }
 100
 101        /// <summary> Queries the number of documents in the index. </summary>
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public Response<long> Count(CancellationToken cancellationToken = default)
 104        {
 20105            using var message = CreateCountRequest();
 20106            _pipeline.Send(message, cancellationToken);
 20107            switch (message.Response.Status)
 108            {
 109                case 200:
 110                    {
 111                        long value = default;
 19112                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 19113                        value = document.RootElement.GetInt64();
 19114                        return Response.FromValue(value, message.Response);
 115                    }
 116                default:
 1117                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 118            }
 19119        }
 120
 121        internal HttpMessage CreateSearchPostRequest(SearchOptions searchRequest)
 122        {
 87123            var message = _pipeline.CreateMessage();
 87124            var request = message.Request;
 87125            request.Method = RequestMethod.Post;
 87126            var uri = new RawRequestUriBuilder();
 87127            uri.AppendRaw(endpoint, false);
 87128            uri.AppendRaw("/indexes('", false);
 87129            uri.AppendRaw(indexName, true);
 87130            uri.AppendRaw("')", false);
 87131            uri.AppendPath("/docs/search.post.search", false);
 87132            uri.AppendQuery("api-version", apiVersion, true);
 87133            request.Uri = uri;
 87134            if (xMsClientRequestId != null)
 135            {
 0136                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 137            }
 87138            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 87139            request.Headers.Add("Content-Type", "application/json");
 87140            var content = new Utf8JsonRequestContent();
 87141            content.JsonWriter.WriteObjectValue(searchRequest);
 87142            request.Content = content;
 87143            return message;
 144        }
 145
 146        /// <summary> Searches for documents in the index. </summary>
 147        /// <param name="searchRequest"> The definition of the Search request. </param>
 148        /// <param name="cancellationToken"> The cancellation token to use. </param>
 149        /// <exception cref="ArgumentNullException"> <paramref name="searchRequest"/> is null. </exception>
 150        public async Task<Response<SearchDocumentsResult>> SearchPostAsync(SearchOptions searchRequest, CancellationToke
 151        {
 0152            if (searchRequest == null)
 153            {
 0154                throw new ArgumentNullException(nameof(searchRequest));
 155            }
 156
 0157            using var message = CreateSearchPostRequest(searchRequest);
 0158            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0159            switch (message.Response.Status)
 160            {
 161                case 200:
 162                    {
 163                        SearchDocumentsResult value = default;
 0164                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0165                        value = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
 0166                        return Response.FromValue(value, message.Response);
 167                    }
 168                default:
 0169                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 170            }
 0171        }
 172
 173        /// <summary> Searches for documents in the index. </summary>
 174        /// <param name="searchRequest"> The definition of the Search request. </param>
 175        /// <param name="cancellationToken"> The cancellation token to use. </param>
 176        /// <exception cref="ArgumentNullException"> <paramref name="searchRequest"/> is null. </exception>
 177        public Response<SearchDocumentsResult> SearchPost(SearchOptions searchRequest, CancellationToken cancellationTok
 178        {
 0179            if (searchRequest == null)
 180            {
 0181                throw new ArgumentNullException(nameof(searchRequest));
 182            }
 183
 0184            using var message = CreateSearchPostRequest(searchRequest);
 0185            _pipeline.Send(message, cancellationToken);
 0186            switch (message.Response.Status)
 187            {
 188                case 200:
 189                    {
 190                        SearchDocumentsResult value = default;
 0191                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0192                        value = SearchDocumentsResult.DeserializeSearchDocumentsResult(document.RootElement);
 0193                        return Response.FromValue(value, message.Response);
 194                    }
 195                default:
 0196                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 197            }
 0198        }
 199
 200        internal HttpMessage CreateGetRequest(string key, IEnumerable<string> selectedFields)
 201        {
 56202            var message = _pipeline.CreateMessage();
 56203            var request = message.Request;
 56204            request.Method = RequestMethod.Get;
 56205            var uri = new RawRequestUriBuilder();
 56206            uri.AppendRaw(endpoint, false);
 56207            uri.AppendRaw("/indexes('", false);
 56208            uri.AppendRaw(indexName, true);
 56209            uri.AppendRaw("')", false);
 56210            uri.AppendPath("/docs('", false);
 56211            uri.AppendPath(key, true);
 56212            uri.AppendPath("')", false);
 56213            if (selectedFields != null)
 214            {
 12215                uri.AppendQueryDelimited("$select", selectedFields, ",", true);
 216            }
 56217            uri.AppendQuery("api-version", apiVersion, true);
 56218            request.Uri = uri;
 56219            if (xMsClientRequestId != null)
 220            {
 0221                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 222            }
 56223            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 56224            return message;
 225        }
 226
 227        /// <summary> Retrieves a document from the index. </summary>
 228        /// <param name="key"> The key of the document to retrieve. </param>
 229        /// <param name="selectedFields"> List of field names to retrieve for the document; Any field not retrieved will
 230        /// <param name="cancellationToken"> The cancellation token to use. </param>
 231        /// <exception cref="ArgumentNullException"> <paramref name="key"/> is null. </exception>
 232        public async Task<Response<IReadOnlyDictionary<string, object>>> GetAsync(string key, IEnumerable<string> select
 233        {
 0234            if (key == null)
 235            {
 0236                throw new ArgumentNullException(nameof(key));
 237            }
 238
 0239            using var message = CreateGetRequest(key, selectedFields);
 0240            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0241            switch (message.Response.Status)
 242            {
 243                case 200:
 244                    {
 245                        IReadOnlyDictionary<string, object> value = default;
 0246                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0247                        Dictionary<string, object> dictionary = new Dictionary<string, object>();
 0248                        foreach (var property in document.RootElement.EnumerateObject())
 249                        {
 0250                            dictionary.Add(property.Name, property.Value.GetObject());
 251                        }
 0252                        value = dictionary;
 0253                        return Response.FromValue(value, message.Response);
 254                    }
 255                default:
 0256                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 257            }
 0258        }
 259
 260        /// <summary> Retrieves a document from the index. </summary>
 261        /// <param name="key"> The key of the document to retrieve. </param>
 262        /// <param name="selectedFields"> List of field names to retrieve for the document; Any field not retrieved will
 263        /// <param name="cancellationToken"> The cancellation token to use. </param>
 264        /// <exception cref="ArgumentNullException"> <paramref name="key"/> is null. </exception>
 265        public Response<IReadOnlyDictionary<string, object>> Get(string key, IEnumerable<string> selectedFields = null, 
 266        {
 0267            if (key == null)
 268            {
 0269                throw new ArgumentNullException(nameof(key));
 270            }
 271
 0272            using var message = CreateGetRequest(key, selectedFields);
 0273            _pipeline.Send(message, cancellationToken);
 0274            switch (message.Response.Status)
 275            {
 276                case 200:
 277                    {
 278                        IReadOnlyDictionary<string, object> value = default;
 0279                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0280                        Dictionary<string, object> dictionary = new Dictionary<string, object>();
 0281                        foreach (var property in document.RootElement.EnumerateObject())
 282                        {
 0283                            dictionary.Add(property.Name, property.Value.GetObject());
 284                        }
 0285                        value = dictionary;
 0286                        return Response.FromValue(value, message.Response);
 287                    }
 288                default:
 0289                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 290            }
 0291        }
 292
 293        internal HttpMessage CreateSuggestPostRequest(SuggestOptions suggestRequest)
 294        {
 26295            var message = _pipeline.CreateMessage();
 26296            var request = message.Request;
 26297            request.Method = RequestMethod.Post;
 26298            var uri = new RawRequestUriBuilder();
 26299            uri.AppendRaw(endpoint, false);
 26300            uri.AppendRaw("/indexes('", false);
 26301            uri.AppendRaw(indexName, true);
 26302            uri.AppendRaw("')", false);
 26303            uri.AppendPath("/docs/search.post.suggest", false);
 26304            uri.AppendQuery("api-version", apiVersion, true);
 26305            request.Uri = uri;
 26306            if (xMsClientRequestId != null)
 307            {
 0308                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 309            }
 26310            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 26311            request.Headers.Add("Content-Type", "application/json");
 26312            var content = new Utf8JsonRequestContent();
 26313            content.JsonWriter.WriteObjectValue(suggestRequest);
 26314            request.Content = content;
 26315            return message;
 316        }
 317
 318        /// <summary> Suggests documents in the index that match the given partial query text. </summary>
 319        /// <param name="suggestRequest"> The Suggest request. </param>
 320        /// <param name="cancellationToken"> The cancellation token to use. </param>
 321        /// <exception cref="ArgumentNullException"> <paramref name="suggestRequest"/> is null. </exception>
 322        public async Task<Response<SuggestDocumentsResult>> SuggestPostAsync(SuggestOptions suggestRequest, Cancellation
 323        {
 0324            if (suggestRequest == null)
 325            {
 0326                throw new ArgumentNullException(nameof(suggestRequest));
 327            }
 328
 0329            using var message = CreateSuggestPostRequest(suggestRequest);
 0330            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0331            switch (message.Response.Status)
 332            {
 333                case 200:
 334                    {
 335                        SuggestDocumentsResult value = default;
 0336                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0337                        value = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
 0338                        return Response.FromValue(value, message.Response);
 339                    }
 340                default:
 0341                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 342            }
 0343        }
 344
 345        /// <summary> Suggests documents in the index that match the given partial query text. </summary>
 346        /// <param name="suggestRequest"> The Suggest request. </param>
 347        /// <param name="cancellationToken"> The cancellation token to use. </param>
 348        /// <exception cref="ArgumentNullException"> <paramref name="suggestRequest"/> is null. </exception>
 349        public Response<SuggestDocumentsResult> SuggestPost(SuggestOptions suggestRequest, CancellationToken cancellatio
 350        {
 0351            if (suggestRequest == null)
 352            {
 0353                throw new ArgumentNullException(nameof(suggestRequest));
 354            }
 355
 0356            using var message = CreateSuggestPostRequest(suggestRequest);
 0357            _pipeline.Send(message, cancellationToken);
 0358            switch (message.Response.Status)
 359            {
 360                case 200:
 361                    {
 362                        SuggestDocumentsResult value = default;
 0363                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0364                        value = SuggestDocumentsResult.DeserializeSuggestDocumentsResult(document.RootElement);
 0365                        return Response.FromValue(value, message.Response);
 366                    }
 367                default:
 0368                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 369            }
 0370        }
 371
 372        internal HttpMessage CreateIndexRequest(IndexBatch batch)
 373        {
 0374            var message = _pipeline.CreateMessage();
 0375            var request = message.Request;
 0376            request.Method = RequestMethod.Post;
 0377            var uri = new RawRequestUriBuilder();
 0378            uri.AppendRaw(endpoint, false);
 0379            uri.AppendRaw("/indexes('", false);
 0380            uri.AppendRaw(indexName, true);
 0381            uri.AppendRaw("')", false);
 0382            uri.AppendPath("/docs/search.index", false);
 0383            uri.AppendQuery("api-version", apiVersion, true);
 0384            request.Uri = uri;
 0385            if (xMsClientRequestId != null)
 386            {
 0387                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 388            }
 0389            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 0390            request.Headers.Add("Content-Type", "application/json");
 0391            var content = new Utf8JsonRequestContent();
 0392            content.JsonWriter.WriteObjectValue(batch);
 0393            request.Content = content;
 0394            return message;
 395        }
 396
 397        /// <summary> Sends a batch of document write actions to the index. </summary>
 398        /// <param name="batch"> The batch of index actions. </param>
 399        /// <param name="cancellationToken"> The cancellation token to use. </param>
 400        /// <exception cref="ArgumentNullException"> <paramref name="batch"/> is null. </exception>
 401        public async Task<Response<IndexDocumentsResult>> IndexAsync(IndexBatch batch, CancellationToken cancellationTok
 402        {
 0403            if (batch == null)
 404            {
 0405                throw new ArgumentNullException(nameof(batch));
 406            }
 407
 0408            using var message = CreateIndexRequest(batch);
 0409            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0410            switch (message.Response.Status)
 411            {
 412                case 200:
 413                case 207:
 414                    {
 415                        IndexDocumentsResult value = default;
 0416                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0417                        value = IndexDocumentsResult.DeserializeIndexDocumentsResult(document.RootElement);
 0418                        return Response.FromValue(value, message.Response);
 419                    }
 420                default:
 0421                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 422            }
 0423        }
 424
 425        /// <summary> Sends a batch of document write actions to the index. </summary>
 426        /// <param name="batch"> The batch of index actions. </param>
 427        /// <param name="cancellationToken"> The cancellation token to use. </param>
 428        /// <exception cref="ArgumentNullException"> <paramref name="batch"/> is null. </exception>
 429        public Response<IndexDocumentsResult> Index(IndexBatch batch, CancellationToken cancellationToken = default)
 430        {
 0431            if (batch == null)
 432            {
 0433                throw new ArgumentNullException(nameof(batch));
 434            }
 435
 0436            using var message = CreateIndexRequest(batch);
 0437            _pipeline.Send(message, cancellationToken);
 0438            switch (message.Response.Status)
 439            {
 440                case 200:
 441                case 207:
 442                    {
 443                        IndexDocumentsResult value = default;
 0444                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0445                        value = IndexDocumentsResult.DeserializeIndexDocumentsResult(document.RootElement);
 0446                        return Response.FromValue(value, message.Response);
 447                    }
 448                default:
 0449                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 450            }
 0451        }
 452
 453        internal HttpMessage CreateAutocompletePostRequest(AutocompleteOptions autocompleteRequest)
 454        {
 36455            var message = _pipeline.CreateMessage();
 36456            var request = message.Request;
 36457            request.Method = RequestMethod.Post;
 36458            var uri = new RawRequestUriBuilder();
 36459            uri.AppendRaw(endpoint, false);
 36460            uri.AppendRaw("/indexes('", false);
 36461            uri.AppendRaw(indexName, true);
 36462            uri.AppendRaw("')", false);
 36463            uri.AppendPath("/docs/search.post.autocomplete", false);
 36464            uri.AppendQuery("api-version", apiVersion, true);
 36465            request.Uri = uri;
 36466            if (xMsClientRequestId != null)
 467            {
 0468                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
 469            }
 36470            request.Headers.Add("Accept", "application/json; odata.metadata=none");
 36471            request.Headers.Add("Content-Type", "application/json");
 36472            var content = new Utf8JsonRequestContent();
 36473            content.JsonWriter.WriteObjectValue(autocompleteRequest);
 36474            request.Content = content;
 36475            return message;
 476        }
 477
 478        /// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summar
 479        /// <param name="autocompleteRequest"> The definition of the Autocomplete request. </param>
 480        /// <param name="cancellationToken"> The cancellation token to use. </param>
 481        /// <exception cref="ArgumentNullException"> <paramref name="autocompleteRequest"/> is null. </exception>
 482        public async Task<Response<AutocompleteResults>> AutocompletePostAsync(AutocompleteOptions autocompleteRequest, 
 483        {
 18484            if (autocompleteRequest == null)
 485            {
 0486                throw new ArgumentNullException(nameof(autocompleteRequest));
 487            }
 488
 18489            using var message = CreateAutocompletePostRequest(autocompleteRequest);
 18490            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 18491            switch (message.Response.Status)
 492            {
 493                case 200:
 494                    {
 495                        AutocompleteResults value = default;
 16496                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 16497                        value = AutocompleteResults.DeserializeAutocompleteResults(document.RootElement);
 16498                        return Response.FromValue(value, message.Response);
 499                    }
 500                default:
 2501                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 502            }
 16503        }
 504
 505        /// <summary> Autocompletes incomplete query terms based on input text and matching terms in the index. </summar
 506        /// <param name="autocompleteRequest"> The definition of the Autocomplete request. </param>
 507        /// <param name="cancellationToken"> The cancellation token to use. </param>
 508        /// <exception cref="ArgumentNullException"> <paramref name="autocompleteRequest"/> is null. </exception>
 509        public Response<AutocompleteResults> AutocompletePost(AutocompleteOptions autocompleteRequest, CancellationToken
 510        {
 18511            if (autocompleteRequest == null)
 512            {
 0513                throw new ArgumentNullException(nameof(autocompleteRequest));
 514            }
 515
 18516            using var message = CreateAutocompletePostRequest(autocompleteRequest);
 18517            _pipeline.Send(message, cancellationToken);
 18518            switch (message.Response.Status)
 519            {
 520                case 200:
 521                    {
 522                        AutocompleteResults value = default;
 16523                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 16524                        value = AutocompleteResults.DeserializeAutocompleteResults(document.RootElement);
 16525                        return Response.FromValue(value, message.Response);
 526                    }
 527                default:
 2528                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 529            }
 16530        }
 531    }
 532}