Files
binarylane-dotnet/docs/pagination.md
T
2026-08-16 21:52:42 +10:00

802 B

Pagination

List endpoints accept one-based page and per_page values. per_page can be between 1 and 200.

Use ListAsync when you need a specific page or the provider's page links:

using BinaryLane.Api.V2.Pagination;

var page = await client.Servers.ListAsync(
    new PageRequest { Page = 1, PerPage = 50 },
    cancellationToken);

foreach (var server in page.Items)
{
    await ProcessAsync(server, cancellationToken);
}

Use ListAllAsync to process every page as it is needed:

await foreach (var server in client.Servers.ListAllAsync(cancellationToken: cancellationToken))
{
    await ProcessAsync(server, cancellationToken);
}

Pass a cancellation token from the calling request, worker, or command so a stopped operation does not continue fetching pages.