private function requestResource($actionPath, $params = [], $method = 'GET')
    {
        $url = $this->getApiUrl() . $actionPath;

        $cookies = CookieJar::fromArray([
            'PVEAuthCookie' => $this->authToken->getTicket(),
        ], $this->credentials->getHostname());

        switch ($method) {
            case 'GET':
                return $this->httpClient->get($url, [
                    'verify' => false,
                    'exceptions' => false,
                    'cookies' => $cookies,
                    'query' => $params,
                ]);
            case 'POST':
            case 'PUT':
            case 'DELETE':
                $headers = [
                    'CSRFPreventionToken' => $this->authToken->getCsrf(),
                ];
                return $this->httpClient->request($method, $url, [
                    'verify' => false,
                    'exceptions' => false,
                    'cookies' => $cookies,
                    'headers' => $headers,
                    'form_params' => $params,
                ]);
            default:
                $errorMessage = "HTTP Request method {$method} not allowed.";
                throw new \InvalidArgumentException($errorMessage);
        }
    }
private function requestResource($actionPath, $params = [], $method = 'GET')
    {
        $url = $this->getApiUrl() . $actionPath;

        $cookies = CookieJar::fromArray([
            'PVEAuthCookie' => $this->authToken->getTicket(),
        ], $this->credentials->getHostname());

        switch ($method) {
            case 'GET':
                return $this->httpClient->get($url, [
                    'verify' => false,
                    'exceptions' => false,
                    'cookies' => $cookies,
                    'query' => $params,
                ]);
            case 'POST':
            case 'PUT':
            case 'DELETE':
                $headers = [
                    'CSRFPreventionToken' => $this->authToken->getCsrf(),
                ];
                return $this->httpClient->request($method, $url, [
                    'verify' => false,
                    'exceptions' => false,
                    'cookies' => $cookies,
                    'headers' => $headers,
                    'form_params' => $params,
                ]);
            default:
                $errorMessage = "HTTP Request method {$method} not allowed.";
                throw new \InvalidArgumentException($errorMessage);
        }
    }
private function requestResource ( $ actionPath , $ params = [ ] , $ method = 'GET' ) { $ url = $ this -> getApiUrl ( ) . $ actionPath ; $ cookies = CookieJar :: fromArray ( [ 'PVEAuthCookie' => $ this -> authToken -> getTicket ( ) , ] , $ this -> credentials -> getHostname ( ) ) ; switch ( $ method ) { case 'GET' : return $ this -> httpClient -> get ( $ url , [ 'verify' => false , 'exceptions' => false , 'cookies' => $ cookies , 'query' => $ params , ] ) ; case 'POST' : case 'PUT' : case 'DELETE' : $ headers = [ 'CSRFPreventionToken' => $ this -> authToken -> getCsrf ( ) , ] ; return $ this -> httpClient -> request ( $ method , $ url , [ 'verify' => false , 'exceptions' => false , 'cookies' => $ cookies , 'headers' => $ headers , 'form_params' => $ params , ] ) ; default : $ errorMessage = "HTTP Request method {$method} not allowed." ; throw new \ InvalidArgumentException ( $ errorMessage ) ; } }
Send a request to a given Proxmox API resource.

@param string $actionPath The resource tree path you want to request, see
more at http://pve.proxmox.com/pve2-api-doc/
@param array $params      An associative array filled with params.
@param string $method     HTTP method used in the request, by default
'GET' method will be used.

@return \Psr\Http\Message\ResponseInterface

@throws \InvalidArgumentException If the given HTTP method is not one of
'GET', 'POST', 'PUT', 'DELETE',
Send a request to a given Proxmox API resource .