src/Mailjet/Client.php
private function _call($method, $resource, $action, $args)
    {
        $args = array_merge(
                [
            'id' => '',
            'actionid' => '',
            'filters' => [],
            'body' => $method == 'GET' ? null : '{}',
                ], array_change_key_case($args)
        );

        $url = $this->buildURL($resource, $action, $args['id'], $args['actionid']);

        $contentType = ($action == 'csvdata/text:plain' || $action == 'csverror/text:csv') ? 'text/plain' : 'application/json';

        $isBasicAuth = $this->isBasicAuthentication($this->apikey, $this->apisecret);
        $auth = $isBasicAuth ? [$this->apikey, $this->apisecret] : [$this->apitoken];

        $request = new Request(
                $auth, $method, $url, $args['filters'], $args['body'], $contentType, $this->requestOptions
        );
        return $request->call($this->call);
    }
private function _call($method, $resource, $action, $args)
    {
        $args = array_merge(
                [
            'id' => '',
            'actionid' => '',
            'filters' => [],
            'body' => $method == 'GET' ? null : '{}',
                ], array_change_key_case($args)
        );

        $url = $this->buildURL($resource, $action, $args['id'], $args['actionid']);

        $contentType = ($action == 'csvdata/text:plain' || $action == 'csverror/text:csv') ? 'text/plain' : 'application/json';

        $isBasicAuth = $this->isBasicAuthentication($this->apikey, $this->apisecret);
        $auth = $isBasicAuth ? [$this->apikey, $this->apisecret] : [$this->apitoken];

        $request = new Request(
                $auth, $method, $url, $args['filters'], $args['body'], $contentType, $this->requestOptions
        );
        return $request->call($this->call);
    }
private function _call ( $ method , $ resource , $ action , $ args ) { $ args = array_merge ( [ 'id' => '' , 'actionid' => '' , 'filters' => [ ] , 'body' => $ method == 'GET' ? null : '{}' , ] , array_change_key_case ( $ args ) ) ; $ url = $ this -> buildURL ( $ resource , $ action , $ args [ 'id' ] , $ args [ 'actionid' ] ) ; $ contentType = ( $ action == 'csvdata/text:plain' || $ action == 'csverror/text:csv' ) ? 'text/plain' : 'application/json' ; $ isBasicAuth = $ this -> isBasicAuthentication ( $ this -> apikey , $ this -> apisecret ) ; $ auth = $ isBasicAuth ? [ $ this -> apikey , $ this -> apisecret ] : [ $ this -> apitoken ] ; $ request = new Request ( $ auth , $ method , $ url , $ args [ 'filters' ] , $ args [ 'body' ] , $ contentType , $ this -> requestOptions ) ; return $ request -> call ( $ this -> call ) ; }
Magic method to call a mailjet resource
@param string $method   Http method
@param string $resource mailjet resource
@param string $action   mailjet resource action
@param array  $args     Request arguments
@return Response server response
Magic method to call a mailjet resource