def iterate(slug, limit: nil, offset: nil, timeout: nil, &block)def iterate: (
String slug,
?limit: Integer?,
?offset: Integer?,
?timeout: seconds?
) -> Enumerator[product_access_entry, nil]
| (
String slug,
?limit: Integer?,
?offset: Integer?,
?timeout: seconds?
) { (product_access_entry) -> void } -> nilAn Enumerator over the grants on a product, yielding one entry at a time and requesting the next page only when the current one is exhausted.
Like access.list_all it yields entries only, so the product private? flag is not reachable from here. Grants added or removed while you iterate can shift the offset window and cause an entry to repeat or be skipped.
Example
require "envless/sdk"
Envless.products.access.iterate("billing") do |grant|
puts "#{grant[:id]} #{grant.dig(:user, :email)}"
endParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | String | Yes | Product slug, or the product uniqueId when the value is UUID shaped. |
limit: | Integer | No | Page size for each underlying request, capped at 100. |
offset: | Integer | No | Row to start the walk from. |
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
An Enumerator[product_access_entry, nil] that yields each grant in turn.
Reads the access collection. list returns one page as an Envless::ProductAccessPage 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
- Revoking inside the loop mutates the collection you are walking, so collect the ids first and revoke afterwards.
Required scopes
product-access:read
Underlying endpoint
GET /products/{slug}/access
Request and response schema, every error code, and a live playground.
In TypeScript
envless.products.access.iterate()
The same method in @goenvless/sdk, with the same request, retries and errors.