Invites

envless.invites.iterate()

Stream pending invitations one at a time

ts
iterate(options?: SearchListOptions): AsyncGenerator<InviteResource, void, undefined>

Returns an async generator that yields invitations individually and fetches the next page only once the current one is drained. Breaking out of the loop stops the requests, which makes this the cheapest way to find the invite for one email address.

The generator defaults to the maximum page size of 100 and clamps anything larger, so limit only ever makes pages smaller. Revoking or resending while you iterate mutates the underlying set that offsets are counted against, so collect the ids first and act on them after the loop.

Example

ts
for await (const invite of envless.invites.iterate()) {
    if (invite.email === 'dana@example.com') {
        console.log(invite.id, invite.status, invite.resendCount)
        break
    }
}

Parameters

ParameterTypeRequiredDescription
options.limitnumberNoPage size per request, capped at 100 and defaulting to 100.
options.offsetnumberNoRow the walk starts at, advancing by the number of items each page returns.
options.searchstringNoCase insensitive substring match on the invited email address.
options.signalAbortSignalNoCancels the request that is in flight and ends the iteration.

Returns

AsyncGenerator<InviteResource, void, undefined> yielding one invitation per step.

Reads the invites 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 generator is lazy, so no request is sent until you start consuming it.

Required scopes

members:read

Underlying endpoint

GET /invites

Request and response schema, every error code, and a live playground.

In Python

envless.invites.iterate()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.invites.iterate

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->invites->iterate()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.