def list_all(
project,
environment,
limit: nil,
offset: nil,
product: nil,
timeout: nil
)def list_all: (
String project,
String environment,
?limit: Integer?,
?offset: Integer?,
?product: (String | Symbol)?,
?timeout: seconds?
) -> Array[version_resource]Walks every page and returns the flattened array 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
require "envless/sdk"
versions = Envless.versions.list_all(
"api",
"production",
product: "billing"
)
puts "#{versions.size} #{versions.first&.fetch(:label)}"Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | String | Yes | Project slug or project uniqueId. |
environment | String | Yes | Environment slug, since an environment uniqueId will not resolve here. |
product: | String | Symbol | No | Product slug used to disambiguate a project slug shared across products. |
limit: | Integer | No | Page size used while walking, clamped to 100. |
offset: | Integer | No | Row to start the walk from. |
timeout: | Integer | Float | Rational | No | Seconds each attempt of this call may take, redirects and the response body included, before it raises Envless::NetworkError with timeout? set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
Array[version_resource] holding every snapshot taken for the environment.
Reads the versions collection. list returns one page as an Envless::Page with items and pagination, list_all collects every page into an array, and iterate yields one item at a time to a block, fetching the next page only when it gets there. Without a block, iterate returns an Enumerator.
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.