Products

Envless.products.list_all_projects

Collect every project in a product

def list_all_projects(
  slug,
  limit: nil,
  offset: nil,
  search: nil,
  order: nil,
  timeout: nil
)

Walks every page of the projects in a product and returns one flat array. Requests use the maximum page size of 100 until the API reports no more rows.

The pagination envelope is dropped, so call list_projects once when you need totalCount. An unknown product, or a private one with no grant, raises here rather than returning an empty array, which makes this a cheap existence check as well.

Example

ruby
require "envless/sdk"

projects = Envless.products.list_all_projects("billing")

puts projects.map { |project| project[:slug] }

Parameters

ParameterTypeRequiredDescription
slugStringYesProduct slug, or the product uniqueId when the value is UUID shaped.
limit:IntegerNoPage size for each underlying request, capped at 100.
offset:IntegerNoRow to start the walk from.
search:String | SymbolNoCase-insensitive substring match against project name and slug.
order:"name" | "asc" | "desc"NoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
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

An Array[project_resource] with every project in the product the key can see.

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

  • Each returned project still carries its own product summary, so the array is safe to concatenate across products.

Required scopes

products:read and projects:read

Underlying endpoint

GET /products/{slug}/projects

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

In TypeScript

envless.products.listAllProjects()

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