@param string            $method
@param string            $uri
@param array             $headers
@param array             $options

@return RequestInterface
13135
public function createRequest($method, $uri, array $headers = [], array $options = [])
    {
        $body = JsonRpc\json_encode($this->addIdToRequest($method, $options));

        return new Request('POST', $uri, $headers, $body === false ? null : $body);
    }
1198389
public function apiCall($method, $url, $options = [])
    {
        if($this->accessToken === null) {
            throw new TokenMissingException();
        }

        $options['headers']['User-Agent'] = self::USER_AGENT . '/' . self::VERSION;
        $request = $this->getAuthenticatedRequest($method, $url, $this->getAccessToken()->getToken(), $options);
        $request = $this->applyOptions($request, $options);

        return $this->getResponse($request);
    }
149281
public function createSealedRequest(
        string $method,
        string $uri,
        string $body,
        SealingPublicKey $key,
        array $headers = []
    ): RequestInterface {
        $sealed = Simple::seal(
            $body,
            $key
        );
        return new Request(
            $method,
            $uri,
            $headers,
            Base64UrlSafe::encode($sealed)
        );
    }
392172
public function create(string $method, string $uri, array $headers = [], $body = null): RequestInterface
    {
        if (!is_array($body)) {
            return $this->getRequestFactory()->createRequest($method, $uri, $headers, $body);
        }

        return $this->getRequestFactory()->createRequest($method, $uri, $headers);
    }
1254842
public function custom(string $method, string $uri, string $body='', array $headers=[])
  {
    $this->sendRequest($this->createRequest($method,$uri), $headers);

    return !is_null($this->getResponse());
  }
531991
public function request($method, $url, $token, array $options = [])
    {
        $request = $this->getAuthenticatedRequest(
            $method, $url, $token, $options
        );

        return $this->getResponse($request);
    }
767508
public function create($method, $url, array $headers = [], $body = null)
    {
        return new Request($method, $url, $headers, $body);
    }
60895
public function request(
        $method,
        $uri,
        array $headers = [],
        ReadableStream $body = null,
        array $options = []
    ): \Generator {
        return $this->send(new BasicRequest($method, $uri, $headers, $body), $options);
    }
946565
public function createRequest($method = 'GET', $uri = null, $headers = null, $body = null, array $options = array())
    {
        $uri = '{+base_path}/' . ltrim($uri, '/');
        if ('GET' == $method && $this->usePostMethod($uri, $options)) {
            $method = 'POST';
            $body = $options['query'];
            unset($options['query']);
        }
        return parent::createRequest($method, $uri, $headers, $body, $options);
    }
489484
public function requestAsync($method, $uri = null, array $options = [])
    {
        return $this->doRequest($method, $uri, $options, true);
    }
917006
public function request($method, $uri = null, array $options = [])
    {
        return $this->doRequest($method, $uri, $options);
    }
835945
public function getRequestWithOptions($method, $uri, array $options = [])
    {
        $options = $this->parseOptions($options);

        return $this->getRequest(
            $method,
            $uri,
            $options['headers'],
            $options['body'],
            $options['version']
        );
    }
420408
public function custom($method,$uri,array $headers,$body)
        {
            return $this->prepareRequest($method,$uri,$headers,$body);
        }
1269631
public function createRequest($method, $url = null, array $options = [])
    {
        $protocol_version = '1.1';
        $body = null;
        $headers = [];

        extract($options);

        $request = new Message\Request;

        $request->setMethod($method);
        $request->setUrl($url ? (string) $this->createUrl($url) : (string) $this->baseUrl);
        $request->setProtocolVersion($protocol_version);

        if (isset($body)) {
            $body = Stream::create($body);
            $request->setBody($body);
        }

        foreach ($headers as $key => $value) {
            $request->setHeader($key, $value);
        }

        return $request;
    }
116004
public function request(string $method, string $url, array $headers = [], string $body = ''): ResponseInterface
    {
        $request = Factory::request($method, $url, $headers, $body);

        return $this->sendRequest($request);
    }
632572
public function invoke($uri, $method, array $headers = [])
    {
        $client   = new Client();
        $res      = $client->createRequest(strtoupper($method), url('/') . '/' . $uri, array_merge($headers, $this->getHeaders()));
        $response = $res->send();
        $types    = $response->getHeader('Content-Type')->toArray();
        $body     = $response->getBody(true);
        foreach ($types as $type) {
            if ($type == 'application/json' && function_exists('json_decode') and is_string($body)) {
                return json_decode($body);
            }
        }

        return $body;
    }
1126803
public function request($method, $uri, array $options = []) {
      $apiToken = $this->addTokens();
      try {
         $options['headers']['Content-Type'] = "application/json";
         $sessionHeaders = [];
         if ($apiToken) {
            if (key_exists('Session-Token', $apiToken) && $apiToken['Session-Token']) {
               $sessionHeaders['Session-Token'] = $apiToken['Session-Token'];
            }
            if (key_exists('App-Token', $apiToken) && $apiToken['App-Token']) {
               $sessionHeaders['App-Token'] = $apiToken['App-Token'];
            }
         }
         $options = array_merge_recursive($options, ['headers' => $sessionHeaders]);
         $response = $this->httpClient->request($method, $this->url . $uri, $options);
         return $response;
      } catch (ClientException $e) {
         $response = $e->getResponse();
         /*$body = $response->getBody()->getContents();
         $reasonPhrase = $response->getReasonPhrase() . (($body) ? ' ' . $body : '');*/
         return $response;
      } catch (RequestException $e) {
         $hasResponse = $e->hasResponse();
         $statusCode = ($hasResponse) ? $e->getResponse()->getStatusCode() : '500';
         $contents = ($hasResponse) ? $e->getResponse()->getReasonPhrase() : 'Request Error';
         throw new Exception($contents, $statusCode);
      }
   }