Products

envless.products.iterate()

Stream products one at a time

ts
iterate(options?: SortedListOptions): AsyncGenerator<ProductResource, void, undefined>

Async generator that yields products one by one and requests the next page only when the current one is exhausted. Nothing is fetched until the first iteration, and breaking out of the loop ends the walk with no further requests.

The walk advances the offset by the number of rows it received, so products created or deleted while you iterate can move the window and cause a row to repeat or be skipped. Treat each page as a snapshot rather than a consistent view of the workspace.

Example

ts
for await (const product of envless.products.iterate({ order: 'asc' })) {
    console.log(product.slug)
}

Parameters

ParameterTypeRequiredDescription
options.limitnumberNoPage size for each underlying request, capped at 100.
options.offsetnumberNoRow to start the walk from.
options.searchstringNoCase-insensitive substring match against product name and slug.
options.orderstringNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
options.signalAbortSignalNoCancels the in-flight request and ends the stream.

Returns

An AsyncGenerator<ProductResource> that yields each product in turn.

Reads the products collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.

Worth knowing

  • This is the only list variant that keeps memory flat, since at most one page is held at a time.

Required scopes

products:read

Underlying endpoint

GET /products

Request and response schema, every error code, and a live playground.

In Python

envless.products.iterate()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.products.iterate

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->products->iterate()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.