static public function bearerRequest($method, $url, $token = null, $data = null)
    {
        $options = [
            'headers' => [
                'User-Agent' => self::USER_AGENT_PREFIX . \Pmp\Sdk::VERSION,
                'Accept' => self::CONTENT_TYPE,
                'Content-Type' => self::CONTENT_TYPE,
            ]
        ];

        if (self::$optGzip) {
            $options['headers']['Accept-Encoding'] = 'gzip,deflate';
        }
        if ($token) {
            $options['headers']['Authorization'] = "Bearer $token";
        }
        if ((strtolower($method) == 'post' || strtolower($method) == 'put') && !empty($data)) {
            $options['body'] = json_encode($data);
        }

        // preferences - only agree to minimal responses for non-home-docs
        $path = parse_url($url, PHP_URL_PATH);
        if (self::$optMinimal && !empty($path)) {
            $options['headers']['Prefer'] = 'return=minimal';
        }

        return self::_sendRequest($method, $url, $options);
    }