예제 #1
0
        public async Task <Response <ServiceStatistics> > GetServiceStatisticsAsync(RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateGetServiceStatisticsRequest(requestOptions);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                ServiceStatistics 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 = ServiceStatistics.DeserializeServiceStatistics(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }