public async ValueTask <Response <SearchServiceStatistics> > GetServiceStatisticsAsync(Guid?xMsClientRequestId = null, CancellationToken cancellationToken = default)
        {
            using var scope = _clientDiagnostics.CreateScope("ServiceClient.GetServiceStatistics");
            scope.Start();
            try
            {
                using var message = CreateGetServiceStatisticsRequest(xMsClientRequestId);
                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

                switch (message.Response.Status)
                {
                case 200:
                {
                    SearchServiceStatistics value = default;
                    using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                    if (document.RootElement.ValueKind == JsonValueKind.Null)
                    {
                        value = null;
                    }
                    else
                    {
                        value = SearchServiceStatistics.DeserializeSearchServiceStatistics(document.RootElement);
                    }
                    return(Response.FromValue(value, message.Response));
                }
예제 #2
0
        public async Task <Response <SearchServiceStatistics> > GetServiceStatisticsAsync(CancellationToken cancellationToken = default)
        {
            using var message = CreateGetServiceStatisticsRequest();
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                SearchServiceStatistics value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = SearchServiceStatistics.DeserializeSearchServiceStatistics(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }