Auto Pagination
Pro Feature
This feature is only available on paid plans. Contact us to get started.
Instead of forcing SDK users to learn the intricacies of your pagination system, Fern SDKs will return an iterator so that users can simply loop through all the results.
TypeScript
Python
When pagination for an endpoint is configured, the TypeScript SDK method
will return a Page<T>
where T
is the underlying data type. The Page<T>
will implement the AsyncIterable
interface, allowing you to use it in a
for await
loop.
Below is an example method signature for a list endpoint:
And here is an example of how a user would use the list
method:
Supported pagination types
Fern supports the following pagination schemes:
Configuration
Annotate the desired paginated endpoint with the x-fern-pagination
extension.
For these fields, you can simply specify the dot-access path to the related request or response property.
For example, should the results of the following object be found in the subfield inner_list
, you would specify results: $response.my_nested_object.inner_list
.