public function call($method, $body = false, $uriAppend = false, $headers = [], $requiresAuthentication = true, $buildQueryParams = true)
    {
        $headers = $this->addRequestHeaders($headers);

        $url = $requiresAuthentication ? $this->client->getAPIEndpoint($this->uri) : $this->client->getAuthEndpoint();
        if ($uriAppend) {
            $url = $url . '/' . $uriAppend;
        }

        $request = clone $this->requestLib;
        $request->setURL($url)
            ->setMethod($method)
            ->addHeaders($headers)
            ->setBody($body);

        if ($buildQueryParams) {
            $request->setQueryStringParams($this->buildQueryStringParams());
        }

        if ($requiresAuthentication) {
            $request->addHeader('Authorization', $this->getAccessToken());
        }

        return $request->make()->getResponse();
    }
public function call($method, $body = false, $uriAppend = false, $headers = [], $requiresAuthentication = true, $buildQueryParams = true)
    {
        $headers = $this->addRequestHeaders($headers);

        $url = $requiresAuthentication ? $this->client->getAPIEndpoint($this->uri) : $this->client->getAuthEndpoint();
        if ($uriAppend) {
            $url = $url . '/' . $uriAppend;
        }

        $request = clone $this->requestLib;
        $request->setURL($url)
            ->setMethod($method)
            ->addHeaders($headers)
            ->setBody($body);

        if ($buildQueryParams) {
            $request->setQueryStringParams($this->buildQueryStringParams());
        }

        if ($requiresAuthentication) {
            $request->addHeader('Authorization', $this->getAccessToken());
        }

        return $request->make()->getResponse();
    }
public function call ( $ method , $ body = false , $ uriAppend = false , $ headers = [ ] , $ requiresAuthentication = true , $ buildQueryParams = true ) { $ headers = $ this -> addRequestHeaders ( $ headers ) ; $ url = $ requiresAuthentication ? $ this -> client -> getAPIEndpoint ( $ this -> uri ) : $ this -> client -> getAuthEndpoint ( ) ; if ( $ uriAppend ) { $ url = $ url . '/' . $ uriAppend ; } $ request = clone $ this -> requestLib ; $ request -> setURL ( $ url ) -> setMethod ( $ method ) -> addHeaders ( $ headers ) -> setBody ( $ body ) ; if ( $ buildQueryParams ) { $ request -> setQueryStringParams ( $ this -> buildQueryStringParams ( ) ) ; } if ( $ requiresAuthentication ) { $ request -> addHeader ( 'Authorization' , $ this -> getAccessToken ( ) ) ; } return $ request -> make ( ) -> getResponse ( ) ; }
Make a call to the API

@param string $method request method to use GET|POST|PUT|PATCH|DELETE
@param array $body any body data to send with the request
@param string $uriAppend any additional URI componenents as a string (eg 'relationships/categories')
@param array $headers any specific headers for the request
@param bool $requiresAuthentication true if the call requires authentication (true for all calls except auth)
@param bool $buildQueryParams should we build query params (sort, limit etc)
@return Moltin\Response
Make a call to the API