API Models BatchTupleOperation - evansims/openfga-php GitHub Wiki
Represents a batch tuple operation containing both writes and deletes. This model organizes tuple operations for batch processing, allowing you to specify both tuples to write and tuples to delete in a single operation. The batch processor will automatically chunk these operations to respect API limits while maintaining the grouping of related changes.
Table of Contents
OpenFGA\Models
BatchTupleOperationInterface
JsonSerializable
ModelInterface
- BatchTupleOperationInterface (interface)
Name | Value | Description |
---|---|---|
MAX_TUPLES_PER_REQUEST |
100 |
Maximum number of tuples allowed per API request. |
OPENAPI_MODEL |
BatchTupleOperation |
public function chunk(int $chunkSize = 100): array
Split this operation into smaller chunks that respect API limits. If the operation doesn't require chunking, returns an array containing only this operation. Otherwise, splits the writes and deletes across multiple operations to stay within the specified chunk size.
Name | Type | Description |
---|---|---|
$chunkSize |
int |
Maximum tuples per chunk (default: API limit) |
array
— Array of operations, each within the chunk size
public function getDeletes(): ?OpenFGA\Models\Collections\TupleKeysInterface
Get the tuples to delete in this operation.
TupleKeysInterface
| null
— Collection of tuples to delete, or null if none
public function getTotalOperations(): int
Get the total number of operations (writes + deletes).
int
— Total count of tuples to be processed
public function getWrites(): ?OpenFGA\Models\Collections\TupleKeysInterface
Get the tuples to write in this operation.
TupleKeysInterface
| null
— Collection of tuples to write, or null if none
public function isEmpty(): bool
Check if this operation is empty (no writes or deletes).
bool
— True if no operations are defined
public function jsonSerialize(): array<string, mixed>
array<
string,
mixed>
public function requiresChunking(int $chunkSize = 100): bool
Check if this operation requires chunking due to size limits.
Name | Type | Description |
---|---|---|
$chunkSize |
int |
Maximum tuples per chunk (default: API limit) |
bool
— True if the operation exceeds the specified chunk size
Implements Models\BatchTupleOperationInterface
public function schema(): SchemaInterface
Get the JSON schema for this model.
SchemaInterface
— The schema definition