API Responses BatchCheckResponse - evansims/openfga-php GitHub Wiki
Response containing the results of a batch authorization check. This response contains a map of correlation IDs to check results, allowing you to match each result back to the original check request using the correlation ID that was provided in the batch request.
Table of Contents
OpenFGA\Responses
- BatchCheckResponseInterface (interface)
- BatchCheckRequest (request)
Implements Responses\BatchCheckResponseInterface
public function fromResponse(
HttpResponseInterface $response,
HttpRequestInterface $request,
SchemaValidatorInterface $validator,
): static
Create 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 getResult(): array
Get the results map from correlation IDs to check results. Each key in the map is a correlation ID from the original request, and each value is the result of that specific check.
array
— Map of correlation ID to check result
public function getResultForCorrelationId(string $correlationId): ?OpenFGA\Models\BatchCheckSingleResultInterface
Get the result for a specific correlation ID. Returns the check result for the given correlation ID, or null if no result exists for that ID.
Name | Type | Description |
---|---|---|
$correlationId |
string |
The correlation ID to look up |