Members

envless.members.iterate()

Stream workspace members one row at a time

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

Yields members individually and fetches the next page only once the current one is drained. Use it when you want to stop at the first match instead of loading the whole set.

It returns an iterator, so put the call straight into a for loop, or an async for loop on AsyncEnvless. No request goes out until the first iteration, and breaking out of the loop leaves the remaining pages unfetched.

Example

from envless import envless

for member in envless.members.iterate():
    user, role = member['user'], member['role']

    if user and user['email'] == 'dev@example.com':
        print(member['id'], role['name'] if role else None)
        break

Parameters

ParameterTypeRequiredDescription
limitintNoPage size fetched behind the scenes, clamped to 100.
offsetintNoRow to start streaming from.
searchstrNoCase insensitive substring match on the member name, email or role name.
role_idstrNoOnly members holding this role, by the role id from roles.list.
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

An iterator that yields MemberResource values until the pages run out.

Reads the members 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 offset advances by the number of rows actually received, so members added mid walk can shift the window.
  • Most workspaces fit inside one page of 100, in which case this makes a single request and ends.

Required scopes

members:read

Underlying endpoint

GET /members

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

In TypeScript

envless.members.iterate()

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