Workspaces

Envless.workspaces.list

List the workspaces the key owner belongs to

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

Returns one page of every workspace the API key owner is a member of. This is the only read in the SDK that leaves the workspace the key is bound to, because it resolves memberships for the owner instead of rows inside one workspace.

Seeing a workspace in items does not mean you can act on it. A key is bound to a single workspace at creation and cannot be retargeted, so the entry with current: true is the only one every other method will touch.

The server loads all memberships before it slices the page, so pagination[:totalCount] is the size of the complete set rather than of the page you received.

Example

ruby
require "envless/sdk"

page = Envless.workspaces.list(limit: 50)

current = page.items.find { |workspace| workspace[:current] }

puts "#{current&.fetch(:slug)} #{page.pagination[:totalCount]}"

Parameters

ParameterTypeRequiredDescription
limit:IntegerNoRows per page, a whole number from 1 to 100, defaulting to 25.
offset:IntegerNoWhole number of rows 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[workspace_resource] with items and a pagination envelope covering every membership.

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 401 with auth.api_key_user_missing means the key is valid but its owner row can no longer be read.

Required scopes

workspace:read

Underlying endpoint

GET /workspaces

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

In TypeScript

envless.workspaces.list()

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