private function apiCall(
        $method,
        array $query = array(),
        callable $onSuccess,
        $emptyValue = null
    ) {
        try {
            return $onSuccess(
                $this->restApiClient->$method($query)
            );
        } catch (BadResponseException $e) {
            if (($response = $e->getResponse())
                && $response->getStatusCode() == 404
            ) {
                return $emptyValue;
            }

            throw $e;
        }
    }
private function apiCall(
        $method,
        array $query = array(),
        callable $onSuccess,
        $emptyValue = null
    ) {
        try {
            return $onSuccess(
                $this->restApiClient->$method($query)
            );
        } catch (BadResponseException $e) {
            if (($response = $e->getResponse())
                && $response->getStatusCode() == 404
            ) {
                return $emptyValue;
            }

            throw $e;
        }
    }
private function apiCall ( $ method , array $ query = array ( ) , callable $ onSuccess , $ emptyValue = null ) { try { return $ onSuccess ( $ this -> restApiClient -> $ method ( $ query ) ) ; } catch ( BadResponseException $ e ) { if ( ( $ response = $ e -> getResponse ( ) ) && $ response -> getStatusCode ( ) == 404 ) { return $ emptyValue ; } throw $ e ; } }
Performs an Api call on given method.

@param string   $method
@param array    $query
@param callable $onSuccess
@param mixed    $emptyValue
Performs an Api call on given method .