Versions

Envless.versions.list_all

Collect every version of an environment

def list_all(
  project,
  environment,
  limit: nil,
  offset: nil,
  product: nil,
  timeout: nil
)

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

ruby
require "envless/sdk"

versions = Envless.versions.list_all(
  "api",
  "production",
  product: "billing"
)

puts "#{versions.size} #{versions.first&.fetch(:label)}"

Parameters

ParameterTypeRequiredDescription
projectStringYesProject slug or project uniqueId.
environmentStringYesEnvironment slug, since an environment uniqueId will not resolve here.
product:String | SymbolNoProduct slug used to disambiguate a project slug shared across products.
limit:IntegerNoPage size used while walking, clamped to 100.
offset:IntegerNoRow to start the walk from.
timeout:Integer | Float | RationalNoSeconds 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 iterate when you want to act on versions as they arrive.
  • Rows carry variableCount only, so reading the values behind every version costs one Envless.versions.get per 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.