-
Notifications
You must be signed in to change notification settings - Fork 6
API Responses WriteTuplesResponse
Response for tuple writing operations supporting both transactional and non-transactional modes. This response handles results from both transactional writes (all-or-nothing) and non-transactional writes (independent operations with detailed tracking).
Table of Contents
OpenFGA\Responses
- WriteTuplesResponseInterface (interface)
- WriteTuplesRequest (request)
Implements Responses\WriteTuplesResponseInterface
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): staticCreate a response instance from an HTTP response. This method transforms a raw HTTP response from the OpenFGA API into a structured response object, validating and parsing the response data according to the expected schema. It handles both successful responses by parsing and validating the data, and error responses by throwing appropriate exceptions.
| Name | Type | Description |
|---|---|---|
$response |
HttpResponseInterface |
The raw HTTP response from the OpenFGA API |
$request |
HttpRequestInterface |
The original HTTP request that generated this response |
$validator |
SchemaValidatorInterface |
Schema validator for parsing and validating response data |
static — The parsed and validated response instance containing the API response data
public function getErrors(): arrayGet all errors that occurred during processing.
array — Array of exceptions from failed operations
public function getFailedChunks(): intGet the number of failed chunks.
int — The number of failed chunks
public function getFirstError(): ?ThrowableGet the first error that occurred.
Throwable | null — The first error, or null if no errors
public function getSuccessRate(): floatCalculate the success rate of the operation.
float — Success rate between 0.0 and 1.0
public function getSuccessfulChunks(): intGet the number of successfully processed chunks.
int — The number of successful chunks
public function getTotalChunks(): intGet the total number of chunks processed (non-transactional mode).
int — The number of chunks, or 1 for transactional mode
public function getTotalOperations(): intGet the total number of tuple operations processed.
int — The total number of write and delete operations
public function isCompleteFailure(): boolCheck if all operations failed.
bool — True if all operations failed
public function isCompleteSuccess(): boolCheck if all operations completed successfully.
bool — True if all operations succeeded
public function isPartialSuccess(): boolCheck if some operations succeeded and some failed.
bool — True if partial success (non-transactional mode only)
public function isTransactional(): boolCheck if the operation was executed in transactional mode.
bool — True if transactional, false if non-transactional
public function throwOnFailure(): voidThrow an exception if any operations failed.
void
Getting Started: Introduction • Installation • Authentication
Essentials: Stores • Authorization Models • Relationship Tuples • Permissions Queries
Features: Helper Functions • Concurrency • Results • Exceptions • Observability • Integration
- API Reference - Full class and method documentation
- Quickstart - Get up and running in minutes
- Helpers - Convenient shortcuts for common operations
- Testing Guide - Unit testing with the SDK
- Performance Guide - Optimize for high-scale applications
- Report Issues - Bug reports and feature requests
- Discussions - Community support and questions
- Contributing - Help improve the SDK
- Changelog - Latest updates and releases
- OpenFGA Documentation - Official OpenFGA documentation
- OpenFGA Playground - Interactive modeling environment
- Authorization Concepts - Learn relationship-based access control
- Other SDKs - JavaScript, Go, Python, .NET, and more
OpenFGA PHP SDK • Apache 2.0 License
- Authorization Stores
- Authorization Models
- Relationship Tuples
- Permission Queries
- Testing with Assertions
- Helper Functions
- Concurrency
- Error Handling
- Framework Integration
- OpenTelemetry Observability
- Result Pattern
- Event Dispatcher
- HTTP Request Sent Event
- HTTP Response Received Event
- Operation Started Event
- Operation Completed Event
- More Events …
- Authentication Exception
- Client Exception
- Configuration Exception
- Network Exception
- Serialization Exception
- More Exceptions …
- Request Manager
- Request Context
- Circuit Breaker
- Parallel Task Executor
- Fiber Concurrent Executor
- Simple Concurrent Executor
- Retry Handler
- Exponential Backoff Retry Strategy
- More Networking …