def list_projects(
slug,
limit: nil,
offset: nil,
search: nil,
order: nil,
timeout: nil
)def list_projects: (
String slug,
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?timeout: seconds?
) -> Page[project_resource]Fetches one page of the projects that belong to a single product. The rows match the flat project list filtered by product, but the scope comes from the path and the key needs both products:read and projects:read.
Prefer this over the workspace-wide project list whenever you care about one product: project slugs are unique per product only, so the flat list can hold the same slug more than once. A key restricted to projects in a different product returns an empty page instead of failing, so an empty items array is not proof that the product has no projects.
Example
require "envless/sdk"
page = Envless.products.list_projects("billing", limit: 25)
page.items.each do |project|
puts "#{project[:slug]} #{project.dig(:product, :slug)}"
endParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | String | Yes | Product slug, or the product uniqueId when the value is UUID shaped. |
limit: | Integer | No | Rows per page, a whole number from 1 to 100. |
offset: | Integer | No | Rows to skip, a whole number of 0 or greater. |
search: | String | Symbol | No | Case-insensitive substring match against project name and slug. |
order: | "name" | "asc" | "desc" | No | Defaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt. |
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
Page[project_resource] holding items and the pagination envelope.
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
pagination[:totalCount]counts only the projects this key is allowed to see.
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.listProjects()
The same method in @goenvless/sdk, with the same request, retries and errors.