private function callOperationAsync($name, \DTS\eBaySDK\Types\BaseType $request = null)
    {
        $operation = static::$operations[$name];

        $paramValues = [];
        $requestValues = [];

        if ($request) {
            $requestArray = $request->toArray();
            $paramValues = array_intersect_key($requestArray, $operation['params']);
            $requestValues = array_diff_key($requestArray, $operation['params']);
        }

        $url = $this->uriResolver->resolve(
            $this->getUrl(),
            $this->getConfig('apiVersion'),
            $operation['resource'],
            $operation['params'],
            $paramValues
        );
        $method = $operation['method'];
        $body = $this->buildRequestBody($requestValues);
        $headers = $this->buildRequestHeaders($body);
        $responseClass = $operation['responseClass'];
        $debug = $this->getConfig('debug');
        $httpHandler = $this->getConfig('httpHandler');
        $httpOptions = $this->getConfig('httpOptions');

        if ($debug !== false) {
            $this->debugRequest($url, $headers, $body);
        }

        $request = new Request($method, $url, $headers, $body);

        return $httpHandler($request, $httpOptions)->then(
            function (ResponseInterface $res) use ($debug, $responseClass) {
                $json = $res->getBody()->getContents();

                if ($debug !== false) {
                    $this->debugResponse($json);
                }

                return new $responseClass(
                    $json !== '' ? json_decode($json, true) : [],
                    $res->getStatusCode(),
                    $res->getHeaders()
                );
            }
        );
    }
private function callOperationAsync($name, \DTS\eBaySDK\Types\BaseType $request = null)
    {
        $operation = static::$operations[$name];

        $paramValues = [];
        $requestValues = [];

        if ($request) {
            $requestArray = $request->toArray();
            $paramValues = array_intersect_key($requestArray, $operation['params']);
            $requestValues = array_diff_key($requestArray, $operation['params']);
        }

        $url = $this->uriResolver->resolve(
            $this->getUrl(),
            $this->getConfig('apiVersion'),
            $operation['resource'],
            $operation['params'],
            $paramValues
        );
        $method = $operation['method'];
        $body = $this->buildRequestBody($requestValues);
        $headers = $this->buildRequestHeaders($body);
        $responseClass = $operation['responseClass'];
        $debug = $this->getConfig('debug');
        $httpHandler = $this->getConfig('httpHandler');
        $httpOptions = $this->getConfig('httpOptions');

        if ($debug !== false) {
            $this->debugRequest($url, $headers, $body);
        }

        $request = new Request($method, $url, $headers, $body);

        return $httpHandler($request, $httpOptions)->then(
            function (ResponseInterface $res) use ($debug, $responseClass) {
                $json = $res->getBody()->getContents();

                if ($debug !== false) {
                    $this->debugResponse($json);
                }

                return new $responseClass(
                    $json !== '' ? json_decode($json, true) : [],
                    $res->getStatusCode(),
                    $res->getHeaders()
                );
            }
        );
    }
private function callOperationAsync ( $ name , \ DTS \ eBaySDK \ Types \ BaseType $ request = null ) { $ operation = static :: $ operations [ $ name ] ; $ paramValues = [ ] ; $ requestValues = [ ] ; if ( $ request ) { $ requestArray = $ request -> toArray ( ) ; $ paramValues = array_intersect_key ( $ requestArray , $ operation [ 'params' ] ) ; $ requestValues = array_diff_key ( $ requestArray , $ operation [ 'params' ] ) ; } $ url = $ this -> uriResolver -> resolve ( $ this -> getUrl ( ) , $ this -> getConfig ( 'apiVersion' ) , $ operation [ 'resource' ] , $ operation [ 'params' ] , $ paramValues ) ; $ method = $ operation [ 'method' ] ; $ body = $ this -> buildRequestBody ( $ requestValues ) ; $ headers = $ this -> buildRequestHeaders ( $ body ) ; $ responseClass = $ operation [ 'responseClass' ] ; $ debug = $ this -> getConfig ( 'debug' ) ; $ httpHandler = $ this -> getConfig ( 'httpHandler' ) ; $ httpOptions = $ this -> getConfig ( 'httpOptions' ) ; if ( $ debug !== false ) { $ this -> debugRequest ( $ url , $ headers , $ body ) ; } $ request = new Request ( $ method , $ url , $ headers , $ body ) ; return $ httpHandler ( $ request , $ httpOptions ) -> then ( function ( ResponseInterface $ res ) use ( $ debug , $ responseClass ) { $ json = $ res -> getBody ( ) -> getContents ( ) ; if ( $ debug !== false ) { $ this -> debugResponse ( $ json ) ; } return new $ responseClass ( $ json !== '' ? json_decode ( $ json , true ) : [ ] , $ res -> getStatusCode ( ) , $ res -> getHeaders ( ) ) ; } ) ; }
Sends an asynchronous API request.

@param string $name The name of the operation.
@param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.

@return \GuzzleHttp\Promise\PromiseInterface A promise that will be resolved with an object created from the JSON response.
Sends an asynchronous API request .