Invites

envless.invites.iterate()

Stream pending invitations one at a time

def iterate(
    *,
    limit: int | None = None,
    offset: int | None = None,
    search: str | None = None,
    timeout: float | None = None,
) -> Iterator[InviteResource]

Returns an iterator 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

from envless import envless

for invite in envless.invites.iterate():
    if invite['email'] == 'dana@example.com':
        print(
            invite['id'],
            invite['status'],
            invite['resendCount'],
        )
        break

Parameters

ParameterTypeRequiredDescription
limitintNoPage size per request, capped at 100 and defaulting to 100.
offsetintNoRow the walk starts at, advancing by the number of items each page returns.
searchstrNoCase insensitive substring match on the invited email address.
timeoutfloatNoSeconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

Iterator[InviteResource] yielding one invitation per step.

Reads the invites collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.

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 TypeScript

envless.invites.iterate()

The same method in @goenvless/sdk, with the same request, retries and errors.