public ResponseWithHeaders <ListQueuesSegmentResponse, ServiceListQueuesSegmentHeaders> ListQueuesSegmentNextPage(string nextLink, string prefix = null, string marker = null, int?maxresults = null, IEnumerable <string> include = null, int?timeout = null, CancellationToken cancellationToken = default)
        {
            if (nextLink == null)
            {
                throw new ArgumentNullException(nameof(nextLink));
            }

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

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

            default:
                throw ClientDiagnostics.CreateRequestFailedException(message.Response);
            }
        }
        public async Task <ResponseWithHeaders <ListQueuesSegmentResponse, ServiceListQueuesSegmentHeaders> > ListQueuesSegmentAsync(string prefix = null, string marker = null, int?maxresults = null, IEnumerable <string> include = null, int?timeout = null, CancellationToken cancellationToken = default)
        {
            using var message = CreateListQueuesSegmentRequest(prefix, marker, maxresults, include, timeout);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            var headers = new ServiceListQueuesSegmentHeaders(message.Response);

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

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