Workspaces

Envless.workspaces.list_all

Collect every workspace into one array

def list_all(limit: nil, offset: nil, timeout: nil)

Walks the pages for you and returns a single flat array of memberships. Most owners belong to a handful of workspaces, so this is usually the right call and rarely costs more than one request.

The pagination envelope is discarded, so you lose totalCount and hasMore. Use list when you need those, or iterate when you want to stop early instead of buffering the whole set.

Example

ruby
require "envless/sdk"

workspaces = Envless.workspaces.list_all

others = workspaces.reject { |workspace| workspace[:current] }

puts others.map { |workspace| workspace[:slug] }

Parameters

ParameterTypeRequiredDescription
limit:IntegerNoPage size used while walking, capped at 100 and defaulting to 100.
offset:IntegerNoRow to start the walk from, so earlier memberships are left out of the result.
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[workspace_resource] holding each workspace the key owner belongs to.

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

  • A failure on any page fails the whole call, and the partially collected rows are lost.

Required scopes

workspace:read

Underlying endpoint

GET /workspaces

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

In TypeScript

envless.workspaces.listAll()

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