def list_all(
project,
limit: nil,
offset: nil,
search: nil,
order: nil,
product: nil,
timeout: nil
)def list_all: (
String project,
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?product: (String | Symbol)?,
?timeout: seconds?
) -> Array[environment_summary_resource]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
require "envless/sdk"
environments = Envless.environments.list_all("api")
puts environments.sizeParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | String | Yes | Project slug or uniqueId that owns the environments. |
product: | String | Symbol | No | Product slug that disambiguates an ambiguous project slug. |
limit: | Integer | No | Page size used for each underlying request, capped at 100. |
offset: | Integer | No | Rows to skip before collection starts. |
search: | String | Symbol | No | Case insensitive substring match on the environment name or slug. |
order: | "name" | "asc" | "desc" | No | asc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name. |
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[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.