API Requests ReadTuplesRequest - evansims/openfga-php GitHub Wiki
Request for reading relationship tuples that match specified criteria. This request retrieves tuples from a store based on filtering criteria, with support for pagination and consistency levels. It's essential for querying existing relationships, debugging authorization data, and building administrative interfaces.
Table of Contents
OpenFGA\Requests
- ReadTuplesResponse (response)
- ReadTuplesRequestInterface (interface)
public function getConsistency(): ?OpenFGA\Models\Enums\Consistency
Get the read consistency level for the read operation. Determines the consistency guarantees for reading relationship tuples. This allows you to balance between read performance and data freshness based on your application's requirements.
Consistency
| null
— The consistency level for the operation, or null to use the default consistency setting
public function getContinuationToken(): ?string
Get the continuation token for paginated results. Returns the pagination token from a previous read operation to continue retrieving results from where the last request left off. This enables efficient pagination through large result sets without missing or duplicating tuples.
string
| null
— The continuation token from a previous read operation, or null for the first page
public function getPageSize(): ?int
Get the maximum number of tuples to return. Specifies the page size for paginated results. This controls how many relationship tuples are returned in a single response. Smaller page sizes reduce memory usage and latency, while larger page sizes reduce the number of API calls needed for large datasets.
int
| null
— The maximum number of tuples to return per page, or null to use the default page size
public function getRequest(Psr\Http\Message\StreamFactoryInterface $streamFactory): OpenFGA\Network\RequestContext
Build a request context for HTTP execution. Transforms the request object into a standardized HTTP request context that can be executed by the OpenFGA HTTP client. This method handles all aspects of request preparation including parameter serialization, URL construction, header configuration, and body stream creation. The method validates that all required parameters are present and properly formatted, serializes complex objects to JSON, constructs the appropriate API endpoint URL, and creates the necessary HTTP message body streams.
Name | Type | Description |
---|---|---|
$streamFactory |
StreamFactoryInterface |
PSR-7 stream factory for creating request body streams from serialized data |
RequestContext
— The prepared request context containing HTTP method, URL, headers, and body ready for execution
public function getStore(): string
Get the store ID containing the tuples to read. Identifies which OpenFGA store contains the relationship tuples to query. All read operations will be performed within the context of this specific store, ensuring data isolation from other stores.
string
— The store ID containing the relationship tuples to read
public function getTupleKey(): OpenFGA\Models\TupleKeyInterface
Get the tuple key pattern for filtering results. Specifies the relationship pattern to match when reading tuples. This can include specific values for object, user, and relation, or use partial patterns with wildcards to match multiple tuples. Empty or null values in the tuple key act as wildcards.
TupleKeyInterface
— The relationship tuple pattern for filtering results