Invites

$envless->invites->listAll()

Collect every pending invitation into one array

php
/** @return list<InviteResource> */
public function listAll(
    ?int $limit = null,
    ?int $offset = null,
    ?string $search = null,
    int|float|null $timeout = null,
): array

Walks the pages and returns a flat array of every outstanding invitation. Pending invite counts are normally small because acceptance and revocation both remove rows, so this usually costs a single request.

The pagination envelope is dropped, so you lose totalCount and hasMore. Reach for list when you need those numbers, or iterate when you want to stop as soon as you find the invite you were looking for.

Example

php
use Envless\Envless;

$envless = new Envless();

$invites = $envless->invites->listAll();

foreach ($invites as $invite) {
    if ($invite['status'] === 'expired') {
        $envless->invites->revoke($invite['id']);
    }
}

Parameters

ParameterTypeRequiredDescription
$limitintNoPage size used while walking, capped at 100 and defaulting to 100.
$offsetintNoRow to start the walk from, so earlier invites are left out of the result.
$searchstringNoCase insensitive substring match on the invited email address, applied to every page.
$timeoutint|floatNoSeconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off.

Returns

list<InviteResource> holding each pending invitation in the workspace.

Reads the invites collection. list returns one page as an Envless\Result\Page with items and pagination, listAll collects every page into an array, and iterate returns a Generator that yields one item at a time, fetching the next page only when the loop gets there.

Worth knowing

  • A failure on any page fails the whole call and the rows already collected are lost.
  • Every page is a separate read, so status values in the array were each computed at a slightly different moment.

Required scopes

members:read

Underlying endpoint

GET /invites

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

In TypeScript

envless.invites.listAll()

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