Responses and models¶
API methods return ApiResponse.
Data envelope¶
$response = $client->projects()->get($projectId);
$response->statusCode; // 200
$response->data(); // object inside top-level data
$response->body; // original response body
$response->json; // decoded object/array
If a response omits the data key, data() returns the decoded body.
Collections¶
collection() processes flat data: [] and nested data.data: [] paginator formats.
Headers¶
Headers are retained as received.
Typed models¶
Models hydrate standard OpenAPI components:
$project = Project::fromResponse($client->projects()->get($id));
$ticket = Ticket::fromResponse($client->tickets()->get($id));
$document = Document::fromResponse($client->documents()->get($id));
Properties are nullable because the underlying schemas do not mark them as required.
Each model retains its source array:
This provides access to fields absent from the model.