public function sendRequest($path, $method = 'GET', array $payload = null)
    {
        $this->getLogger()->debug(sprintf('%s %s', $method, $path));

        $request = $this->messageFactory->createRequest(
            $method,
            $this->baseUri . '/' . ltrim($path, '/'),
            ['apiKey' => $this->token]
        );

        if ($payload) {
            $request = $this->buildRequestBody($request, $payload);
            $this->getLogger()->debug(
                sprintf(
                    'Sending payload with "%s" content type',
                    $request->getHeaderLine('Content-type')
                )
            );
        } else {
            try {
                $request = $request->withHeader('Content-length', '0');
            } catch (\InvalidArgumentException $e) {
                throw new \LogicException($e->getMessage(), $e->getCode(), $e);
            }
        }

        try {
            $response = $this->httpClient->sendRequest($request);
        } catch (\Exception $e) {
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }

        if ($response->getStatusCode() !== 200) {
            $message = sprintf(
                'HTTP %d: %s',
                $response->getStatusCode(),
                $response->getReasonPhrase()
            );
            $this->getLogger()->error($message);
            throw new RuntimeException($message);
        }

        $type = explode(';', $response->getHeaderLine('Content-type'));
        $type = reset($type);
        switch ($type) {
            case 'application/json':
                $this->getLogger()->debug('Response body is a JSON');

                return $this->parseJson((string) $response->getBody());
            // break not needed
            case 'application/octet-stream':
                $this->getLogger()->debug('Response body is a stream');

                return $response->getBody();
            // break not needed
        }

        throw new RuntimeException('Unexpected response content type:' . $type);
    }