def iterate(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
timeout: float | None = None,
) -> Iterator[ProductAccessEntry]def iterate(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
timeout: float | None = None,
) -> AsyncIterator[ProductAccessEntry]An iterator 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.list_all 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
from envless import envless
for grant in envless.products.access.iterate('billing'):
user = grant['user']
print(grant['id'], user['email'] if user else None)import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
async for grant in envless.products.access.iterate('billing'):
user = grant['user']
print(grant['id'], user['email'] if user else None)
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | str | Yes | Product slug, or the product uniqueId when the value is UUID shaped. |
limit | int | No | Page size for each underlying request, capped at 100. |
offset | int | No | Row to start the walk from. |
timeout | float | No | Seconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
An Iterator[ProductAccessEntry] that yields each grant in turn.
Reads the access collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.
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 TypeScript
envless.products.access.iterate()
The same method in @goenvless/sdk, with the same request, retries and errors.