Пример #1
0
        public ResponseWithHeaders <ListSharesResponse, ServiceListSharesSegmentHeaders> ListSharesSegmentNextPage(string nextLink, string prefix = null, string marker = null, int?maxresults = null, IEnumerable <ListSharesIncludeType> include = null, int?timeout = null, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

            using var message = CreateListSharesSegmentNextPageRequest(nextLink, prefix, marker, maxresults, include, timeout);
            _pipeline.Send(message, cancellationToken);
            var headers = new ServiceListSharesSegmentHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 200:
            {
                ListSharesResponse value = default;
                var document             = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
                if (document.Element("EnumerationResults") is XElement enumerationResultsElement)
                {
                    value = ListSharesResponse.DeserializeListSharesResponse(enumerationResultsElement);
                }
                return(ResponseWithHeaders.FromValue(value, headers, message.Response));
            }

            default:
                throw _clientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
Пример #2
0
        public async Task <ResponseWithHeaders <ListSharesResponse, ServiceListSharesSegmentHeaders> > ListSharesSegmentAsync(string prefix = null, string marker = null, int?maxresults = null, IEnumerable <ListSharesIncludeType> include = null, int?timeout = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateListSharesSegmentRequest(prefix, marker, maxresults, include, timeout);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            var headers = new ServiceListSharesSegmentHeaders(message.Response);

            switch (message.Response.Status)
            {
            case 200:
            {
                ListSharesResponse value = default;
                var document             = XDocument.Load(message.Response.ContentStream, LoadOptions.PreserveWhitespace);
                if (document.Element("EnumerationResults") is XElement enumerationResultsElement)
                {
                    value = ListSharesResponse.DeserializeListSharesResponse(enumerationResultsElement);
                }
                return(ResponseWithHeaders.FromValue(value, headers, message.Response));
            }

            default:
                throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
            }
        }