sdk/dotnet/src/Microsoft.Datasync.Client/Table/RemoteTable.cs
/// <summary>
/// Gets a single page of items produced as a result of a query against the server.
/// </summary>
/// <param name="query">The query string to send to the service.</param>
/// <param name="requestUri">The request URI to send (if we're on the second or future pages)</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
/// <returns>A <see cref="Page{JToken}"/> containing the page of items.</returns>
Gets a single page of items produced as a result of a query against the server.
Gets a single page of items produced as a result of a query against the server .
protected async Task<Page<JToken>> GetNextPageAsync(string query = "", string requestUri = null, CancellationToken cancellationToken = default)
        {
            string queryString = string.IsNullOrEmpty(query) ? string.Empty : $"?{query.TrimStart('?').TrimEnd()}";
            ServiceRequest request = new()
            {
                Method = HttpMethod.Get,
                UriPathAndQuery = requestUri ?? CreateUriPath(TableName) + queryString,
                EnsureResponseContent = true
            };
            var response = await SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
            var result = new Page<JToken>();
            if (response is JObject)
            {
                if (response[Page.JsonItemsProperty]?.Type == JTokenType.Array)
                {
                    result.Items = ((JArray)response[Page.JsonItemsProperty] as JArray).ToList();
                }
                if (response[Page.JsonCountProperty]?.Type == JTokenType.Integer)
                {
                    result.Count = response.Value<long>(Page.JsonCountProperty);
                }
                if (response[Page.JsonNextLinkProperty]?.Type == JTokenType.String)
                {
                    result.NextLink = new Uri(response.Value<string>(Page.JsonNextLinkProperty));
                }
            }
            return result;
        }
protected async Task < Page < JToken > > GetNextPageAsync ( string query = " " , string requestUri = null , CancellationToken cancellationToken = default ) { string queryString = string . IsNullOrEmpty ( query ) ? string . Empty : $" ? { query . TrimStart ( ' ' ) . TrimEnd ( ) } " ; ServiceRequest request = new ( ) { Method = HttpMethod . Get , UriPathAndQuery = requestUri ?? CreateUriPath ( TableName ) + queryString , EnsureResponseContent = true } ; var response = await SendRequestAsync ( request , cancellationToken ) . ConfigureAwait ( false ) ; var result = new Page < JToken > ( ) ; if ( response is JObject ) { if ( response [ Page . JsonItemsProperty ] ? . Type == JTokenType . Array ) { result . Items = ( ( JArray ) response [ Page . JsonItemsProperty ] as JArray ) . ToList ( ) ; } if ( response [ Page . JsonCountProperty ] ? . Type == JTokenType . Integer ) { result . Count = response . Value < long > ( Page . JsonCountProperty ) ; } if ( response [ Page . JsonNextLinkProperty ] ? . Type == JTokenType . String ) { result . NextLink = new Uri ( response . Value < string > ( Page . JsonNextLinkProperty ) ) ; } } return result ; }
Gets a single page of items produced as a result of a query against the server.
Gets a single page of items produced as a result of a query against the server .
A  containing the page of items.
A containing the page of items .
query
string
The query string to send to the service.
The query string to send to the service .
requestUri
string
The request URI to send (if we're on the second or future pages)
The request URI to send ( if we ' re on the second or future pages )
cancellationToken
CancellationToken
A  to observe.
A to observe .