def list_all(
project: str,
environment: str,
*,
limit: int | None = None,
offset: int | None = None,
product: str | None = None,
timeout: float | None = None,
) -> list[VersionResource]async def list_all(
project: str,
environment: str,
*,
limit: int | None = None,
offset: int | None = None,
product: str | None = None,
timeout: float | None = None,
) -> list[VersionResource]Walks every page and returns the flattened list of versions, newest first. An environment is capped at 1000 versions on every plan, so the result stays bounded even on a long lived project.
limit= is the page size used while walking, not a cap on how many versions come back: a limit of 5 still returns the whole history, just in more round trips. It is clamped to the API maximum of 100, so asking for more buys nothing.
Example
from envless import envless
versions = envless.versions.list_all(
'api', 'production', product='billing'
)
print(
len(versions), versions[0]['label'] if versions else None
)import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
versions = await envless.versions.list_all(
'api', 'production', product='billing'
)
print(
len(versions), versions[0]['label'] if versions else None
)
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | str | Yes | Project slug or project uniqueId. |
environment | str | Yes | Environment slug, since an environment uniqueId will not resolve here. |
product | str | No | Product slug used to disambiguate a project slug shared across products. |
limit | int | No | Page size used while walking, clamped to 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
list[VersionResource] holding every snapshot taken for the environment.
Reads the versions 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
- Nothing is returned until the final page lands. Use
iteratewhen you want to act on versions as they arrive. - Rows carry
variableCountonly, so reading the values behind every version costs oneenvless.versions.getper row. - On the Free plan only the latest version is listed; the older ones are stored but need Dev or above to be read, and reading one there is 402
plan.upgrade_required.
Required scopes
versions:read
Underlying endpoint
GET /projects/{slug}/environments/{environmentSlug}/versions
Request and response schema, every error code, and a live playground.
In TypeScript
envless.versions.listAll()
The same method in @goenvless/sdk, with the same request, retries and errors.