def list(limit: nil, offset: nil, search: nil, order: nil, timeout: nil)def list: (
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?timeout: seconds?
) -> Page[product_resource]Fetches one page of the products the key can reach, unwrapped into items plus a pagination envelope. Private products with no grant for the key owner are filtered out before pagination is applied, so pagination[:totalCount] is the number of products this key can see and never the raw workspace total.
Every row carries locked, which is true for products sitting beyond the plan allowance. Locked products still list and still read, but an update against one is refused. search matches name and slug, order defaults to name and sorts A to Z, with asc and desc sorting oldest and newest first on createdAt.
Example
require "envless/sdk"
page = Envless.products.list(limit: 10, search: "api")
page.items.each do |product|
puts "#{product[:slug]} #{product.fetch(:locked, false)}"
endParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
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 product 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[product_resource] holding items and the pagination envelope.
Reads the products 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
limitoutside 1 to 100 is rejected as invalid pagination rather than clamped. - Pagination happens in memory after the access filter, so page boundaries shift if grants change between calls.
Required scopes
products:read
Underlying endpoint
GET /products
Request and response schema, every error code, and a live playground.
In TypeScript
envless.products.list()
The same method in @goenvless/sdk, with the same request, retries and errors.