SevenShores\Hubspot\Http\Client::request PHP Method

request() public method

..
public request ( string $method, string $endpoint, array $options = [], string $query_string = null, boolean $requires_auth = true ) : Response
$method string The HTTP request verb
$endpoint string The Hubspot API endpoint
$options array An array of options to send with the request
$query_string string A query string to send with the request
$requires_auth boolean Whether or not this HubSpot API endpoint requires authentication
return Response
    function request($method, $endpoint, $options = [], $query_string = null, $requires_auth = true)
    {
        $url = $this->generateUrl($endpoint, $query_string, $requires_auth);
        $options["headers"]["User-Agent"] = $this->user_agent;
        if ($this->oauth2) {
            $options["headers"]["Authorization"] = "Bearer " . $this->key;
        }
        try {
            return new Response($this->client->request($method, $url, $options));
        } catch (\Exception $e) {
            throw new BadRequest($e->getMessage(), $e->getCode(), $e);
        }
    }