Pagination

The SDK provides two approaches to pagination: manual control via list() and automatic async iteration via list_all().


list()

Manual Pagination

All list() methods accept skip and take parameters for manual pagination. The response includes a meta.count field with the total number of matching records.

Parameters

  • Name
    skip
    Type
    int
    Description

    Number of records to skip. Defaults to 0.

  • Name
    take
    Type
    int
    Description

    Number of records to return. Defaults to 25.

Response Meta

  • Name
    meta.count
    Type
    int
    Description

    Total number of records matching the query. Use this with skip and take to calculate pages.

Manual Pagination

# Fetch page 1 (first 20 records)
page1 = await client.bookings.list({
    "organisation": "org-id",
    "skip": 0,
    "take": 20,
})

print(page1["data"])          # List of bookings
print(page1["meta"]["count"]) # Total count, e.g. 154

# Fetch page 2
page2 = await client.bookings.list({
    "organisation": "org-id",
    "skip": 20,
    "take": 20,
})

list_all()

Auto-Pagination

Most resources provide a list_all() method that returns an async iterator. This automatically fetches pages in the background as you iterate, so you never have to manage skip and take manually.

The iterator fetches 25 records per page internally and yields them one at a time.

Auto-Pagination with async for

# Iterate one by one
async for booking in client.bookings.list_all({
    "organisation": "org-id",
}):
    print(booking["id"], booking["customer_name"])

to_array()

Collecting All Results

If you need all records in memory at once, use the to_array() helper to collect the full async iterable into a list.

  • Name
    to_array(iterable)
    Type
    async function
    Description

    Accepts any async iterable and returns a list of all items.

Collecting All Results

from felloh import FellohClient, to_array
from felloh.types import FellohConfig

client = FellohClient(FellohConfig(
    public_key="your-public-key",
    private_key="your-private-key",
))

all_bookings = await to_array(
    client.bookings.list_all({"organisation": "org-id"})
)

print(f"Total: {len(all_bookings)} bookings")