Workspaces

envless.workspaces.list_all()

Collect every workspace into one list

def list_all(
    *,
    limit: int | None = None,
    offset: int | None = None,
    timeout: float | None = None,
) -> list[WorkspaceResource]

Walks the pages for you and returns a single flat list of memberships. Most owners belong to a handful of workspaces, so this is usually the right call and rarely costs more than one request.

The pagination envelope is discarded, so you lose totalCount and hasMore. Use list when you need those, or iterate when you want to stop early instead of buffering the whole set.

Example

from envless import envless

workspaces = envless.workspaces.list_all()

others = [
    workspace['slug']
    for workspace in workspaces
    if not workspace['current']
]

print(others)

Parameters

ParameterTypeRequiredDescription
limitintNoPage size used while walking, capped at 100 and defaulting to 100.
offsetintNoRow to start the walk from, so earlier memberships are left out of the result.
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

list[WorkspaceResource] holding each workspace the key owner belongs to.

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

  • A failure on any page fails the whole call, and the partially collected rows are lost.

Required scopes

workspace:read

Underlying endpoint

GET /workspaces

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

In TypeScript

envless.workspaces.listAll()

The same method in @goenvless/sdk, with the same request, retries and errors.