def iterate(
limit: nil,
offset: nil,
search: nil,
order: nil,
timeout: nil,
&block
)def iterate: (
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?timeout: seconds?
) -> Enumerator[webhook_resource, nil]
| (
?limit: Integer?,
?offset: Integer?,
?search: (String | Symbol)?,
?order: ("name" | "asc" | "desc")?,
?timeout: seconds?
) { (webhook_resource) -> void } -> nilReturns an Enumerator that yields endpoints individually and fetches the next page only once the current one is drained. Nothing is requested until you start consuming it, and breaking out of the loop stops the requests, so this is the cheapest way to find the endpoint pointed at one URL.
The Enumerator defaults to the maximum page size of 100 and clamps anything larger, so limit only ever makes pages smaller. Creating or deleting endpoints while you iterate shifts the offsets the walk counts against, so collect ids first and act on them after the loop.
Example
require "envless/sdk"
Envless.webhooks.iterate do |hook|
if hook[:url] == "https://hooks.example.com/envless"
puts "#{hook[:id]} #{hook[:eventTypes]}"
break
end
endParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit: | Integer | No | Page size per request, capped at 100 and defaulting to 100. |
offset: | Integer | No | Row the walk starts at, advancing by the number of items each page returns. |
search: | String | Symbol | No | Case insensitive substring match across name, url and description. |
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
Enumerator[webhook_resource, nil] yielding one endpoint per step.
Reads the webhooks 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
- The
Enumeratoris lazy, so an abandoned loop costs at most the pages you consumed.
Required scopes
webhooks:read
Underlying endpoint
GET /webhooks
Request and response schema, every error code, and a live playground.
In TypeScript
envless.webhooks.iterate()
The same method in @goenvless/sdk, with the same request, retries and errors.