src/BaseClientRemote.php
public function createRequest($method, $path, $options)
    {
        if ($this->isPsr7Version()) {
            $headers = [
                'Content-Type'  => 'application/json',
                'Authorization' => 'Bearer ' . $this->getAccessToken(),
            ];

            $body = ArrayUtils::get($options, 'body', null);
            $uri = UriResolver::resolve(new Uri($this->getBaseEndpoint() . '/'), new Uri($path));

            if ($body) {
                $body = json_encode($body);
            }

            if (ArrayUtils::has($options, 'query')) {
                $query = $options['query'];

                if (is_array($query)) {
                    $query = http_build_query($query, null, '&', PHP_QUERY_RFC3986);
                }

                if (!is_string($query)) {
                    throw new \InvalidArgumentException('query must be a string or array');
                }

                $uri = $uri->withQuery($query);
            }

            $request = new Request($method, $uri, $headers, $body);
        } else {
            $options['auth'] = [$this->accessToken, ''];

            $request = $this->httpClient->createRequest($method, $path, $options);

            $query = ArrayUtils::get($options, 'query');
            if ($query) {
                $q = $request->getQuery();
                foreach($query as $key => $value) {
                    $q->set($key, $value);
                }
            }
        }

        return $request;
    }
public function createRequest($method, $path, $options)
    {
        if ($this->isPsr7Version()) {
            $headers = [
                'Content-Type'  => 'application/json',
                'Authorization' => 'Bearer ' . $this->getAccessToken(),
            ];

            $body = ArrayUtils::get($options, 'body', null);
            $uri = UriResolver::resolve(new Uri($this->getBaseEndpoint() . '/'), new Uri($path));

            if ($body) {
                $body = json_encode($body);
            }

            if (ArrayUtils::has($options, 'query')) {
                $query = $options['query'];

                if (is_array($query)) {
                    $query = http_build_query($query, null, '&', PHP_QUERY_RFC3986);
                }

                if (!is_string($query)) {
                    throw new \InvalidArgumentException('query must be a string or array');
                }

                $uri = $uri->withQuery($query);
            }

            $request = new Request($method, $uri, $headers, $body);
        } else {
            $options['auth'] = [$this->accessToken, ''];

            $request = $this->httpClient->createRequest($method, $path, $options);

            $query = ArrayUtils::get($options, 'query');
            if ($query) {
                $q = $request->getQuery();
                foreach($query as $key => $value) {
                    $q->set($key, $value);
                }
            }
        }

        return $request;
    }
Creates a request for 5.x or 6.x guzzle version

@param $method
@param $path
@param $options

@return \GuzzleHttp\Message\Request|\GuzzleHttp\Message\RequestInterface|Request