Removed invalid syntax from pagination docs

This commit is contained in:
Jonas Dellinger 2020-06-15 22:39:43 +02:00
parent 5ac1077cfe
commit 76f1a4746e

View File

@ -14,10 +14,8 @@ It allows to receive only a subset of all available data and dynamically check i
`PaginateAll` will query all remaining elements based on a first page and return all of them in a `IList`. This method should not be used for a huge amount of pages (e.g `Search` Endpoint), since it stores every response in memory. `PaginateAll` will query all remaining elements based on a first page and return all of them in a `IList`. This method should not be used for a huge amount of pages (e.g `Search` Endpoint), since it stores every response in memory.
```csharp ```csharp
// we need the first page, every syntax can be used for pagination // we need the first page
var page = await spotify.Playlists.CurrentUsers(); var page = await spotify.Playlists.CurrentUsers();
var page = spotify.Playlists.CurrentUsers();
var page = () => spotify.Playlists.CurrentUsers();
// allPages will include the first page retrived before // allPages will include the first page retrived before
var allPages = await spotify.PaginateAll(page); var allPages = await spotify.PaginateAll(page);
@ -31,10 +29,8 @@ var allPages = await spotify.PaginateAll(page);
`Paginate` is based on `IAsyncEnumerable` and streams pages instead of returning them all in one list. This allows to break the fetching early and keeps only 1 page in memory at a time. This method should always be preferred to `PaginateAll` `Paginate` is based on `IAsyncEnumerable` and streams pages instead of returning them all in one list. This allows to break the fetching early and keeps only 1 page in memory at a time. This method should always be preferred to `PaginateAll`
```csharp ```csharp
// we need the first page, every syntax can be used for pagination // we need the first page
var page = await spotify.Playlists.CurrentUsers(); var page = await spotify.Playlists.CurrentUsers();
var page = spotify.Playlists.CurrentUsers();
var page = () => spotify.Playlists.CurrentUsers();
await foreach(var item in spotify.Paginate(page)) await foreach(var item in spotify.Paginate(page))
{ {