def iterate_projects(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> Iterator[ProjectResource]def iterate_projects(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> AsyncIterator[ProjectResource]An iterator 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
from envless import envless
for project in envless.products.iterate_projects('billing'):
print(project['slug'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
async for project in envless.products.iterate_projects('billing'):
print(project['slug'])
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. |
search | str | No | Case-insensitive substring match against project name and slug. |
order | str | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
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[ProjectResource] that yields each project in the product.
Reads the projects 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
- 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 TypeScript
envless.products.iterateProjects()
The same method in @goenvless/sdk, with the same request, retries and errors.