mirror of
https://github.com/alexhopeoconnor/binarylane-dotnet.git
synced 2026-10-22 05:42:08 +10:00
Initial BinaryLane v2 API client
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# 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:
|
||||
|
||||
```csharp
|
||||
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:
|
||||
|
||||
```csharp
|
||||
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.
|
||||
Reference in New Issue
Block a user