protected function sendRequest($requiredParams, $params, $callback)
    {
        $response = $this->client->send($requiredParams, array_merge($params, [
            'module' => static::getModule(),
            'controller' => static::getController(),
            'version' => $this->version,
        ]), function ($response) use ($callback) {
            if (isset($response->error)) {
                return $response;
            }
            return call_user_func($callback, $response);
        });
        if (isset($response->error)) {
            $this->lastError = isset($response->error->message) ? $response->error->message : 'Unknown error!';
            if ($this->client->softExceptionEnabled) {
                if (isset($response->meta['statusCode']) ? $response->meta['statusCode'] : false) {
                    throw $response->error->exception;
                }
                throw new Exception('API error ' . (isset($response->error->code) ? $response->error->code : -1) . '!');
            }
        }

        return $response;
    }
protected function sendRequest($requiredParams, $params, $callback)
    {
        $response = $this->client->send($requiredParams, array_merge($params, [
            'module' => static::getModule(),
            'controller' => static::getController(),
            'version' => $this->version,
        ]), function ($response) use ($callback) {
            if (isset($response->error)) {
                return $response;
            }
            return call_user_func($callback, $response);
        });
        if (isset($response->error)) {
            $this->lastError = isset($response->error->message) ? $response->error->message : 'Unknown error!';
            if ($this->client->softExceptionEnabled) {
                if (isset($response->meta['statusCode']) ? $response->meta['statusCode'] : false) {
                    throw $response->error->exception;
                }
                throw new Exception('API error ' . (isset($response->error->code) ? $response->error->code : -1) . '!');
            }
        }

        return $response;
    }
protected function sendRequest ( $ requiredParams , $ params , $ callback ) { $ response = $ this -> client -> send ( $ requiredParams , array_merge ( $ params , [ 'module' => static :: getModule ( ) , 'controller' => static :: getController ( ) , 'version' => $ this -> version , ] ) , function ( $ response ) use ( $ callback ) { if ( isset ( $ response -> error ) ) { return $ response ; } return call_user_func ( $ callback , $ response ) ; } ) ; if ( isset ( $ response -> error ) ) { $ this -> lastError = isset ( $ response -> error -> message ) ? $ response -> error -> message : 'Unknown error!' ; if ( $ this -> client -> softExceptionEnabled ) { if ( isset ( $ response -> meta [ 'statusCode' ] ) ? $ response -> meta [ 'statusCode' ] : false ) { throw $ response -> error -> exception ; } throw new Exception ( 'API error ' . ( isset ( $ response -> error -> code ) ? $ response -> error -> code : - 1 ) . '!' ) ; } } return $ response ; }
Sends the request to the Shardimage API and returns with the Response
object or the ID for the request if deferred.

Optionally throws an exception for soft errors.

@param string[] $requiredParams Mandatory API parameters for precheck
@param array    $params         API parameters
@param callable $callback       Response callback

@return Response|string

@throws Exception|HttpException
Sends the request to the Shardimage API and returns with the Response object or the ID for the request if deferred .