Added cursor pagination support to paged operations.
This commit is contained in:
1 parent
fde2382056
commit
c984be3263
7 files changed
+4340
-4
No files matched your search
@@ -73,6 +73,21 @@ let apps = try response.ok.body.json.data
|
||||
|
||||
The `ok` property throws for any other response. To handle those, switch over the `Output` cases, such as `.unauthorized` or `.undocumented(statusCode:_:)`.
|
||||
|
||||
### Fetching More Pages
|
||||
|
||||
Lists are paged. Pass a page's `links.nextCursor` as the `cursor` of the next request:
|
||||
|
||||
```swift
|
||||
var apps: [Components.Schemas.App] = []
|
||||
var cursor: String?
|
||||
|
||||
repeat {
|
||||
let page = try await client.appsGetCollection(query: .init(limit: 200, cursor: cursor)).ok.body.json
|
||||
apps += page.data
|
||||
cursor = page.links.nextCursor
|
||||
} while cursor != nil
|
||||
```
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- iOS 13.0+
|
||||
|
||||
Reference in new issue
Block a user