Products

envless.products.list_projects()

List the projects inside one product

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
    )

Parameters

ParameterTypeRequiredDescription
slugstrYesProduct slug, or the product uniqueId when the value is UUID shaped.
limitintNoRows per page, a whole number from 1 to 100.
offsetintNoRows to skip, a whole number of 0 or greater.
searchstrNoCase-insensitive substring match against project name and slug.
orderstrNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
timeoutfloatNoSeconds 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.