public sealed class RestPagedAsyncEnumerable<TRequest, TResponse, TResource> : PagedAsyncEnumerable<TResponse, TResource>, IAsyncEnumerable<TResource> where TRequest : class, IClientServiceRequest<TResponse> where TResponse : class
An asynchronous sequence of resources, obtained lazily via API operations which retrieve a page at a time.
public override Task<Page<TResource>> ReadPageAsync(int pageSize, CancellationToken cancellationToken = default)
Eagerly (but asynchronously) reads a single page of results with a fixed maximum size. The returned page is guaranteed
to have that many results, unless there is no more data available.
"Natural" pages returned by the API may contain a smaller number of resources than requested.
For example, a request for a page with 100 resources may return a page with 80 resources but
a next page token for more to be retrieved. This is suitable for batch-processing, but not
for user-visible paging such as in a web application, where fixed-size pages are expected.
This method may make more than one API call in order to fill the page, but after the page has been
returned, all the data will have been loaded. (In particular, iterating over the items in the page
multiple times will not make any further requests.)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003e\u003ccode\u003eRestPagedAsyncEnumerable<TRequest, TResponse, TResource>\u003c/code\u003e is a class that provides an asynchronous sequence of resources, fetched one page at a time via API operations.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements \u003ccode\u003eIAsyncEnumerable<TResource>\u003c/code\u003e, allowing for asynchronous iteration over the resources, and is part of the \u003ccode\u003eGoogle.Api.Gax.Rest\u003c/code\u003e namespace.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version available is 4.10.0, and older versions, such as 4.8.0, 4.4.0, 4.3.1, 4.2.0, 4.0.0, and 3.2.0 are also listed for reference.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRestPagedAsyncEnumerable\u003c/code\u003e class is constructed with a \u003ccode\u003erequestProvider\u003c/code\u003e function and an \u003ccode\u003eIPageManager\u003c/code\u003e to handle API requests and responses effectively.\u003c/p\u003e\n"],["\u003cp\u003eIt includes methods like \u003ccode\u003eAsRawResponses()\u003c/code\u003e, which returns a sequence of raw API responses, and \u003ccode\u003eReadPageAsync()\u003c/code\u003e, which asynchronously reads a fixed-size page of results, managing potential multiple API calls to fill the page as requested.\u003c/p\u003e\n"]]],[],null,["# Class RestPagedAsyncEnumerable<TRequest, TResponse, TResource> (4.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.10.0 (latest)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [4.8.0](/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [4.4.0](/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [4.3.1](/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [4.2.0](/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [4.0.0](/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3)\n- [3.2.0](/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.Rest.RestPagedAsyncEnumerable-3) \n\n public sealed class RestPagedAsyncEnumerable\u003cTRequest, TResponse, TResource\u003e : PagedAsyncEnumerable\u003cTResponse, TResource\u003e, IAsyncEnumerable\u003cTResource\u003e where TRequest : class, IClientServiceRequest\u003cTResponse\u003e where TResponse : class\n\nAn asynchronous sequence of resources, obtained lazily via API operations which retrieve a page at a time. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [PagedAsyncEnumerable](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2) \\\u003e RestPagedAsyncEnumerable\\\u003cTRequest, TResponse, TResource\\\u003e \n\nImplements\n----------\n\n[IAsyncEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.iasyncenumerable-1) \n\nInherited Members\n-----------------\n\n[PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.AsRawResponses()](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2#Google_Api_Gax_PagedAsyncEnumerable_2_AsRawResponses) \n[PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.ReadPageAsync(int, CancellationToken)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2#Google_Api_Gax_PagedAsyncEnumerable_2_ReadPageAsync_System_Int32_System_Threading_CancellationToken_) \n[PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.GetAsyncEnumerator(CancellationToken)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2#Google_Api_Gax_PagedAsyncEnumerable_2_GetAsyncEnumerator_System_Threading_CancellationToken_) \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Api.Gax.Rest](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Rest)\n\nAssembly\n--------\n\nGoogle.Api.Gax.Rest.dll\n\nConstructors\n------------\n\n### RestPagedAsyncEnumerable(Func\\\u003cTRequest\\\u003e, IPageManager\\\u003cTRequest, TResponse, TResource\\\u003e)\n\n public RestPagedAsyncEnumerable(Func\u003cTRequest\u003e requestProvider, IPageManager\u003cTRequest, TResponse, TResource\u003e pageManager)\n\nCreates a new lazily-evaluated sequence from the given API call, initial request, and call settings.\n\nMethods\n-------\n\n### AsRawResponses()\n\n public override IAsyncEnumerable\u003cTResponse\u003e AsRawResponses()\n\nReturns the sequence of raw API responses, each of which contributes a page of\nresources to this sequence.\n\n**Overrides** \nGoogle.Api.Gax.PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.AsRawResponses()\n\n### GetAsyncEnumerator(CancellationToken)\n\n public override IAsyncEnumerator\u003cTResource\u003e GetAsyncEnumerator(CancellationToken cancellationToken)\n\nReturns an enumerator that iterates asynchronously through the collection.\n\n**Overrides** \n[PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.GetAsyncEnumerator(CancellationToken)](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)\n\n### ReadPageAsync(int, CancellationToken)\n\n public override Task\u003cPage\u003cTResource\u003e\u003e ReadPageAsync(int pageSize, CancellationToken cancellationToken = default)\n\nEagerly (but asynchronously) reads a single page of results with a fixed maximum size. The returned page is guaranteed\nto have that many results, unless there is no more data available.\n\n**Overrides** \n[PagedAsyncEnumerable\\\u003cTResponse, TResource\\\u003e.ReadPageAsync(int, CancellationToken)](https://learn.microsoft.com/dotnet/api/system.int32)\n**Remarks** \n\"Natural\" pages returned by the API may contain a smaller number of resources than requested.\nFor example, a request for a page with 100 resources may return a page with 80 resources but\na next page token for more to be retrieved. This is suitable for batch-processing, but not\nfor user-visible paging such as in a web application, where fixed-size pages are expected.\nThis method may make more than one API call in order to fill the page, but after the page has been\nreturned, all the data will have been loaded. (In particular, iterating over the items in the page\nmultiple times will not make any further requests.)"]]