Skip to main content

PagedResult<T>

A class in Alta.Api.Client, Alta.Api.Client.LowLevel.

Pages through a paged Alta API endpoint, following the paginationToken response header.

Constructors​

MemberWhat it is
PagedResult(Func<PagedConfig, Task<HttpResponseMessage>> getNext, PagedConfig config = null)Creates a PagedResult from getNext and config.

Fields​

3 private and internal fields
MemberWhat it is
private readonly PagedConfig configPage size and current pagination token. Defaults to a limit of 20.
private readonly Func<PagedConfig, Task<HttpResponseMessage>> getNextFunction that sends the request for a page using the config.
private bool hasRunWhether a page has been fetched yet.

Properties​

MemberWhat it is
bool HasNext { get; }True before the first fetch, and after that while the API returned a pagination token.
IEnumerable<T> Results { get; private set; }Results of the last page fetched, or of all pages after GetAllAsync.

Methods​

MemberWhat it is
async Task<IEnumerable<T>> GetAllAsync()Fetches every remaining page and returns all results together, then resets to the first page.
async Task<IEnumerable<T>> GetNextAsync()Fetches the next page and returns its results.
1 private and internal method
MemberWhat it is
private async Task<IEnumerable<T>> HandleResponse(HttpResponseMessage response)Reads the page's results and the next paginationToken header, or throws on an error status.

Used in​

Members of other types that take, return or hold a PagedResult&lt;T>: