Skip to content

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

$boards = $client->boards()->list($projectId)->collection();

collection() processes flat data: [] and nested data.data: [] paginator formats.

Headers

$requestId = $response->requestId();
$retryAfter = $response->header('Retry-After');

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:

$ticket->raw['new_field'] ?? null;

This provides access to fields absent from the model.