Versions

envless.versions.iterate()

Stream versions one row at a time

ts
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

ts
for await (const version of envless.versions.iterate('api', 'production')) {
    if (version.note?.includes('migration')) {
        console.log(version.id)
        break
    }
}

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug or project uniqueId.
environmentstringYesEnvironment slug, since an environment uniqueId will not resolve here.
options.productstringNoProduct slug used to disambiguate a project slug shared across products.
options.limitnumberNoPage size fetched behind the scenes, clamped to 100.
options.offsetnumberNoRow to start streaming from.
options.signalAbortSignalNoCancels 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.