src/Scalify/PuppetMaster/Client/Client.php
private function getJsonBody(RequestInterface $request, ResponseInterface $response): array
    {
        $data = json_decode($response->getBody(), true);
        if (!$data || !is_array($data) || !array_key_exists("data", $data)) {
            throw new ClientException("Response body does not contain a valid JSON object.", $request, $response);
        }

        if (!is_array($data) || !is_array($data["data"])) {
            throw new ClientException("Not sure what happened. The list jobs endpoint didn't return a list. :worried:", $request, $response);
        }

        return $data["data"];
    }
private function getJsonBody(RequestInterface $request, ResponseInterface $response): array
    {
        $data = json_decode($response->getBody(), true);
        if (!$data || !is_array($data) || !array_key_exists("data", $data)) {
            throw new ClientException("Response body does not contain a valid JSON object.", $request, $response);
        }

        if (!is_array($data) || !is_array($data["data"])) {
            throw new ClientException("Not sure what happened. The list jobs endpoint didn't return a list. :worried:", $request, $response);
        }

        return $data["data"];
    }
Returns the JSON data field from given response.

@param RequestInterface  $request
@param ResponseInterface $response

@return array