Products

$envless->products->access->list()

List member grants and the privacy flag

php
public function list(
    string $slug,
    ?int $limit = null,
    ?int $offset = null,
    int|float|null $timeout = null,
): ProductAccessPage

Reads one page of the explicit member grants recorded on a product. The returned page adds isPrivate alongside items and pagination, and the two have to be read together: grants are stored whether or not the product is private, so an empty items array on a public product still means every workspace member can read it. The grant list only becomes an access control list once isPrivate is true.

items[$i]['id'] is the workspace member id, the same id space the grant and revoke calls take, not the user id. The user id sits on items[$i]['user']['id'], and user is null when no user record is attached to the membership. Entries are ordered by when each member joined the workspace, oldest first, then paginated in memory.

Example

php
use Envless\Envless;

$envless = new Envless();

$page = $envless->products->access->list('billing');

echo $page->isPrivate ? 'private' : 'public', PHP_EOL;
echo $page->pagination['totalCount'], PHP_EOL;

foreach ($page->items as $entry) {
    echo $entry['id'], ' ', $entry['user']['email'] ?? '', PHP_EOL;
}

Parameters

ParameterTypeRequiredDescription
$slugstringYesProduct slug, or the product uniqueId when the value is UUID shaped.
$limitintNoRows per page, a whole number from 1 to 100.
$offsetintNoRows to skip, a whole number of 0 or greater.
$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

ProductAccessPage with items, pagination and the product isPrivate flag.

Reads the access collection. list returns one page as an Envless\Result\ProductAccessPage 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

  • The response collection key is access, so a raw HTTP caller reads data.access where the SDK exposes items.

Required scopes

product-access:read

Underlying endpoint

GET /products/{slug}/access

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

In TypeScript

envless.products.access.list()

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