Products

envless.products.iterateProjects()

Stream the projects in a product one by one

ts
iterateProjects(slug: string, options?: SortedListOptions): AsyncGenerator<ProjectResource, void, undefined>

Async generator over the projects in a product, yielding one row at a time and fetching the next page only when the current one runs out. Break out of the loop to stop the walk.

Because the walk moves by offset, projects created or deleted mid-iteration can shift the window and cause a row to repeat or be missed. The scope requirement is the same as the page read: the key needs both products:read and projects:read.

Example

ts
for await (const project of envless.products.iterateProjects('billing')) {
    console.log(project.slug)
}

Parameters

ParameterTypeRequiredDescription
slugstringYesProduct slug, or the product uniqueId when the value is UUID shaped.
options.limitnumberNoPage size for each underlying request, capped at 100.
options.offsetnumberNoRow to start the walk from.
options.searchstringNoCase-insensitive substring match against project 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<ProjectResource> that yields each project in the product.

Reads the projects 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

  • The first request is not sent until the loop starts, so an unreachable product surfaces on the first iteration and not at call time.

Required scopes

products:read and projects:read

Underlying endpoint

GET /products/{slug}/projects

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

In Python

envless.products.iterate_projects()

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

In Ruby

Envless.products.iterate_projects

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

In PHP

$envless->products->iterateProjects()

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