iterate(project: string, environment: string, options?: ScopedListOptions): AsyncGenerator<VersionResource, void, undefined>Yields versions individually, fetching the next page only once the current one is drained. This is the right shape for scanning history for a particular label or note, because it stops fetching the moment you break.
It returns an async generator, not a promise, so do not await the call itself: put it straight into a for await loop. No request goes out until the first iteration.
Example
for await (const version of envless.versions.iterate('api', 'production')) {
if (version.note?.includes('migration')) {
console.log(version.id)
break
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | string | Yes | Project slug or project uniqueId. |
environment | string | Yes | Environment slug, since an environment uniqueId will not resolve here. |
options.product | string | No | Product slug used to disambiguate a project slug shared across products. |
options.limit | number | No | Page size fetched behind the scenes, clamped to 100. |
options.offset | number | No | Row to start streaming from. |
options.signal | AbortSignal | No | Cancels the in flight page request and ends the stream. |
Returns
An AsyncGenerator that yields VersionResource values until the pages run out.
Reads the versions collection. list returns one page as { items, pagination }, listAll collects every page into an array, and iterate streams one item at a time without buffering the whole set.
Worth knowing
- The offset advances by the number of rows actually received, so publishing a version mid walk shifts the window and can repeat a row.
- On the Free plan only the latest version is listed; the older ones are stored but need Dev or above to be read, and reading one there is 402
plan.upgrade_required.
Required scopes
versions:read
Underlying endpoint
GET /projects/{slug}/environments/{environmentSlug}/versions
Request and response schema, every error code, and a live playground.
In Python
envless.versions.iterate()
The same method in envless-sdk, the Python SDK, with the same request, retries and errors.
In Ruby
Envless.versions.iterate
The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.
In PHP
$envless->versions->iterate()
The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.