def list_projects(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> Page[ProjectResource]async def list_projects(
slug: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
timeout: float | None = None,
) -> Page[ProjectResource]Fetches one page of the projects that belong to a single product. The rows match the flat project list filtered by product, but the scope comes from the path and the key needs both products:read and projects:read.
Prefer this over the workspace-wide project list whenever you care about one product: project slugs are unique per product only, so the flat list can hold the same slug more than once. A key restricted to projects in a different product returns an empty page instead of failing, so an empty items list is not proof that the product has no projects.
Example
from envless import envless
page = envless.products.list_projects('billing', limit=25)
for project in page['items']:
product = project['product']
print(
project['slug'], product['slug'] if product else None
)import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
page = await envless.products.list_projects('billing', limit=25)
for project in page['items']:
product = project['product']
print(
project['slug'], product['slug'] if product 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 | Rows per page, a whole number from 1 to 100. |
offset | int | No | Rows to skip, a whole number of 0 or greater. |
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
Page[ProjectResource] holding items and the pagination envelope.
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
pagination['totalCount']counts only the projects this key is allowed to see.
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.listProjects()
The same method in @goenvless/sdk, with the same request, retries and errors.