private async IAsyncEnumerable <JsonElement> GetArrayAsync(IAzureTenant tenant, string nextLink, ListRequestOptions?options, [EnumeratorCancellation] CancellationToken cancellationToken)
        {
            string?link = nextLink;

            var reqOptions = new RequestHeaderOptions {
                ConsistencyLevelEventual = options?.ConsistencyLevelEventual ?? false
            };

            do
            {
                var root = await GetAsync(tenant, link, reqOptions, cancellationToken).ConfigureAwait(false);

                options?.OnPageReceived(root);

                foreach (var item in root.GetProperty("value").EnumerateArray())
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        yield break;
                    }

                    yield return(item);
                }

                HandleNextLink(root, ref link);
            } while (link != null);
        }
        private async Task <DeltaResult <JsonElement> > GetDeltaAsync(IAzureTenant tenant, string nextLink, DeltaRequestOptions?options, CancellationToken cancellationToken)
        {
            var result = new List <JsonElement>();

            string?nLink = nextLink;
            string?dLink = default;

            RequestHeaderOptions?reqOptions = null;

            if (options?.PreferMinimal == true)
            {
                reqOptions = new RequestHeaderOptions {
                    PreferMinimal = true
                };
            }

            do
            {
                var root = await GetAsync(tenant, nLink, reqOptions, cancellationToken).ConfigureAwait(false);

                foreach (var item in root.GetProperty("value").EnumerateArray())
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }

                    result.Add(item);
                }

                if (cancellationToken.IsCancellationRequested)
                {
                    break;
                }

                HandleNextLink(root, ref nLink);
                HandleDeltaLink(root, ref dLink);
            } while (nLink != null);

            return(new DeltaResult <JsonElement>(result, dLink));
        }