Products

envless.products.access.iterate()

Stream member grants one at a time

ts
access.iterate(slug: string, options?: ListOptions): AsyncGenerator<ProductAccessEntry, void, undefined>

Async generator over the grants on a product, yielding one entry at a time and requesting the next page only when the current one is exhausted.

Like access.listAll it yields entries only, so the product isPrivate flag is not reachable from here. Grants added or removed while you iterate can shift the offset window and cause an entry to repeat or be skipped.

Example

ts
for await (const grant of envless.products.access.iterate('billing')) {
    console.log(grant.id, grant.user?.email)
}

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.signalAbortSignalNoCancels the in-flight request and ends the stream.

Returns

An AsyncGenerator<ProductAccessEntry> that yields each grant in turn.

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

  • Revoking inside the loop mutates the collection you are walking, so collect the ids first and revoke afterwards.

Required scopes

product-access:read

Underlying endpoint

GET /products/{slug}/access

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

In Python

envless.products.access.iterate()

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

In Ruby

Envless.products.access.iterate

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

In PHP

$envless->products->access->iterate()

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