API Responses WriteTuplesResponseInterface - evansims/openfga-php GitHub Wiki
Interface for tuple writing response objects. This interface defines the contract for responses returned when writing relationship tuples to an OpenFGA store. The response handles both transactional and non-transactional write modes, providing appropriate feedback for each operation type. In transactional mode, all changes succeed or fail together. In non-transactional mode, operations are processed independently with detailed success/failure tracking.
Table of Contents
OpenFGA\Responses
- WriteTuplesResponse (implementation)
- WriteTuplesRequestInterface (request)
public function getErrors(): array<Throwable>
Get all errors that occurred during processing.
array<
Throwable>
— Array of exceptions from failed operations
public function getFailedChunks(): int
Get the number of failed chunks.
int
— The number of failed chunks
public function getFirstError(): Throwable|null
Get the first error that occurred.
Throwable
| null
— The first error, or null if no errors
public function getSuccessRate(): float
Calculate the success rate of the operation.
float
— Success rate between 0.0 and 1.0
public function getSuccessfulChunks(): int
Get the number of successfully processed chunks.
int
— The number of successful chunks
public function getTotalChunks(): int
Get the total number of chunks processed (non-transactional mode).
int
— The number of chunks, or 1 for transactional mode
public function getTotalOperations(): int
Get the total number of tuple operations processed.
int
— The total number of write and delete operations
public function isCompleteFailure(): bool
Check if all operations failed.
bool
— True if all operations failed
public function isCompleteSuccess(): bool
Check if all operations completed successfully.
bool
— True if all operations succeeded
public function isPartialSuccess(): bool
Check if some operations succeeded and some failed.
bool
— True if partial success (non-transactional mode only)
public function isTransactional(): bool
Check if the operation was executed in transactional mode.
bool
— True if transactional, false if non-transactional
public function throwOnFailure(): void
Throw an exception if any operations failed.
void