Versions

Envless.versions.list

Read one page of environment versions

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

Returns one page of the snapshots taken for an environment, newest first, as items plus the raw pagination envelope. Rows are metadata only: label, note, variableCount, environmentId and createdAt, with no variables and no ciphertext. Pass a row id to Envless.versions.get for the contents.

Nothing is fetched past the page you asked for, so read pagination[:hasMore] before assuming you hold the whole history. label is assigned server side as v1, v2 and so on from a count of existing versions, which means it is not unique forever. Treat id as the identity and never look a version up by label.

Example

ruby
require "envless/sdk"

page = Envless.versions.list("api", "production", limit: 50)

page.items.each do |version|
  puts "#{version[:label]} #{version[:variableCount]}"
end

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:IntegerNoRows per page, a whole number from 1 to 100.
offset:IntegerNoRows to skip before the page starts.
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

Page[version_resource] with items and the pagination envelope.

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

  • Versions always come back newest first.
  • An environment holds at most 1000 versions on every plan, so the history is bounded no matter how old the project is.
  • 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.list()

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