Environments

Envless.environments.list_all

Collect every environment in a project

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

Walks every page of the environments in a project and returns one flat array. limit sets the page size, capped at 100, not the number of rows you get back, so raising or lowering it changes the request count and nothing else.

All rows are buffered in memory before the call returns, and each row has the same fields list returns, exposed and updatedAt included. Environment counts are small by design, since the allowance is per project rather than per workspace, so this is usually the read you want.

Example

ruby
require "envless/sdk"

environments = Envless.environments.list_all("api")

puts environments.size

Parameters

ParameterTypeRequiredDescription
projectStringYesProject slug or uniqueId that owns the environments.
product:String | SymbolNoProduct slug that disambiguates an ambiguous project slug.
limit:IntegerNoPage size used for each underlying request, capped at 100.
offset:IntegerNoRows to skip before collection starts.
search:String | SymbolNoCase insensitive substring match on the environment name or slug.
order:"name" | "asc" | "desc"Noasc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name.
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[environment_summary_resource] with one entry per environment in the project.

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

  • An ambiguous project slug fails on the first request, so nothing is collected and no partial array is returned.
  • A timeout on any page fails the whole call; there is no partial result to recover.

Required scopes

environments:read

Underlying endpoint

GET /projects/{slug}/environments

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

In TypeScript

envless.environments.listAll()

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