@param RequestParams $params

@return bool|mixed
@throws ApiError
@throws AuthError
@throws ClientError
@throws GuzzleException
@throws Exception
559333
private function request(RequestParams $params)
    {
        /*
         * Build Resource URI
         */
        $rm = $params->resourceMetadata;
        $base = $this->config['base_url'] . $this->config['api_path'] . "/";

        if (!empty($params->appId)) {
            $url = $base . 'General/Apps/' . $params->appId . '/callBackend';
        } else {
            $url = $base . $rm->product . '/' . $rm->resource;
        }

        if (!empty($params->id)) {
            $url .= '/' . $params->id;
        }

        if (!empty($params->action)) {
            $url .= '/' . $params->action;
        }

        if (!empty($params->actionArg)) {
            $url .= '/' . $params->actionArg;
        }

        $options = array_merge(['auth' => 'oauth'], $params->options);

        if (!array_key_exists(\GuzzleHttp\RequestOptions::HEADERS, $options)) {
            $options[\GuzzleHttp\RequestOptions::HEADERS] = [];
        }

        /*
         * Result filtering, sorting & searching
         */
        $p = [];
        if (!empty($params->searchParams->query)) {
            $q = $params->searchParams->query;

            if (!empty($q->count)) {
                $p['count'] = $q->count;
            }

            if (!empty($q->offset)) {
                $p['offset'] = $q->offset;
            }

            if (!empty($q->query)) {
                $p['q'] = $q->query;
            }

            if (!empty($q->fields)) {
                $p['fields'] = implode(',', $q->fields);
            }

            if (!empty($q->sortOrder)) {
                foreach ($q->sortOrder as $key => $value) {
                    $p['sort[' . $key . ']'] = $value;
                }
            }
        }

        if (!empty($params->searchParams->scrollId)) {
            $p['scroll_id'] = $params->searchParams->scrollId;
        }

        if (!empty($params->searchParams->scrollExpire)) {
            $p['scroll_expire'] = $params->searchParams->scrollExpire;
        }

        if (count($p) != 0) {
            $options[\GuzzleHttp\RequestOptions::QUERY] = $p;
        }

        /*
         * JSON Body
         */

        if (!empty($params->jsonData)) {
            $options[\GuzzleHttp\RequestOptions::BODY] = $params->jsonData;
            $options[\GuzzleHttp\RequestOptions::HEADERS]['Content-Type'] = 'application/json';
        }

        /*
         * Idempotence (avoid double execution of the same request)
         */
        if ($this->actionId !== null) {
            $options[\GuzzleHttp\RequestOptions::HEADERS]['X-Action'] = $this->actionId;
            $this->setActionId(null);
        }

        /*
         * Run request
         */
        try {
            $response = $this->httpClient->request($params->operation, $url, $options);
        } catch (Exception $e) {
            throw $this->mapError($e, 'Error sending API request.');
        }

        if ($response->getStatusCode() == 200) {
            return MapperUtil::mapResponse($response);
        }

        return false;
    }
356798
public function submit(RequestParameters $params)
    {
        $options = array(
            'http' => array(
                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                'method' => 'POST',
                'content' => $params->toQueryString(),
                // Force the peer to validate (not needed in 5.6.0+, but still works)
                'verify_peer' => true,
            ),
        );
        $context = stream_context_create($options);
        $response = file_get_contents($this->siteVerifyUrl, false, $context);

        if ($response !== false) {
            return $response;
        }

        return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
    }
658504
protected function prepareParams(array $params)
    {
        foreach ($params as $key => $param) {
            if (gettype($param) === 'boolean') {
                $params[$key] = (string)(($param) ? 'true' : 'false');
            }
        }
        return $params;
    }
487257
public function get(array $queryParams = [])
    {
        $response = $this->client->get("{$this->uri()}", [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
264770
public function submit(RequestParameters $params)
    {
        $handle = $this->curl->init($this->siteVerifyUrl);

        $options = array(
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $params->toQueryString(),
            CURLOPT_HTTPHEADER => array(
                'Content-Type: application/x-www-form-urlencoded'
            ),
            CURLINFO_HEADER_OUT => false,
            CURLOPT_HEADER => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_SSL_VERIFYPEER => true
        );
        $this->curl->setoptArray($handle, $options);

        $response = $this->curl->exec($handle);
        $this->curl->close($handle);

        if ($response !== false) {
            return $response;
        }

        return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
    }
874255
protected function executeRequest(Uri $uri, array $params = null)
    {
        $guzzle = new GuzzleClient(['verify' => $this->connection->getVerifySsl()]);

        return $guzzle->request(
            $this->connection->getHttpMethod(),
            $uri,
            null !== $params ? ['form_params' => $params] : []
        );
    }
467648
public function getByParams($params)
	{
		try {
			//validate
			$obj    = new \erdiko\users\entities\User;
			$params = (array) $params;
			$filter = array();
			foreach ($params as $key => $value) {
				$method = "get" . ucfirst( $key );
				if (method_exists($obj, $method)) {
					$filter[ $key ] = $value;
				}
			}
			$repo   = $this->getRepository( 'erdiko\users\entities\User' );
			$result = empty($filter)
				? $this->getUsers()
				: $repo->findBy( $filter );
		} catch (\Exception $e) {
			throw new \Exception($e->getMessage());
		}
		return $result;
	}
31593
protected function getAccessTokenRequest(array $params)
    {
        $request = parent::getAccessTokenRequest($params);
        $uri = $request->getUri()
            ->withUserInfo($this->clientId, $this->clientSecret);

        return $request->withUri($uri);
    }
1041564
public function setRequestParams($requestParams)
    {
        $this->requestParams = $requestParams;
        $this->requestParams['integration_key'] = Config::getIntegrationKey();
        return $this;
    }
375736
public function getAccessTokenByClientCredentials(array $params = array())
    {
        $params = array(
            'grant_type' => 'client_credentials',
            'client_id' => $this->getClientId(),
            'client_secret'	=> $this->getClientSecret(),
        ) + $params;
        $request = $this->request('GET', 'oauth/2.0/token', $params);
        return $request->response()->getJson(true);
    }
70552
final public static function execute(Parameters $params) {

        $asked_method = $params->get('method');

        $method = $params->methods()->get($asked_method);

        if ( is_null($method) ) throw new RpcException("Method not found", -32601);

        return $method->getDescription();

    }
1180810
public function retrieveIdByEmail($requestParams)
    {
        $requiredParams = array(
            "objectID",
            "email"
        );
        return $this->client->request($requestParams, $this->_endpoint . "/" . self::GET_BY_EMAIL, "get", $requiredParams , $options = NULL);
    }
34633
public function request($api, $params = array(), $entity = false)
    {
        $api = ServiceFactory::get($api);

        $url = $api->getEndPoint();

        if ((count($params) > 0) && ($api->getRequiredParam())) {
            foreach ($params as $item) {
                $url.= '/' . filter_var($item, FILTER_SANITIZE_URL);
            }
        }

        $body = array();
        if ($entity) {
            $body = [
                'body' => $entity->toJSON()
            ];
        }

        try {
            $response = $this->client->request(
                $api->getMethod(),
                $url,
                $body
            );

        } catch (\Exception $e) {
            $response = $e->getResponse();
        }

        return $response->getBody()->getContents();
    }
668601
public function request($params)
  {
    $query = array_merge($params, [
      'key' => $this->key
    ]);

    try {

      $response = $this->client->get(self::API_ENDPOINT, [
        'query' => $query
      ]);

    } catch (ClientException $exception) {

      return collect([]);

    }

    $results = json_decode($response->getBody(), true);

    $output = [];

    for($i = 0; $i < count($results['itemListElement']); $i++) {
      $output[] = new SearchResult($results['itemListElement'][$i]);
    }

    return collect($output);
  }
1173181
public function get($url, array $params = [])
    {
       $queryString = '?' . http_build_query($params);

       $url = $url . $queryString;

       $request = new Request(
            $url,
            'GET'
        );

        return $this->send($request);
    }
760541
public function auth($params)
	{
		$requestParams = $this->initRequestParams('auth', $params);
		$this->request('auth', $requestParams);

		return empty($this->error);
	}
1022598
public function execute($requestParams = array()){

        $this->getQueryBuilder()->setBulkInsert($requestParams);
       
        $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::SAVE_QUERY, QueryBuilder::PARENT_ONLY);

        $this->beginTransaction();
        try{
            $result = $this->query("$query", FALSE);
      
            $this->commitTransaction();
        }catch(Exception $e){
          
            error_log($e->getMessage());
            $this->rollbackTransaction();
        }
        if(array_key_exists('locale', $requestParams)) {
            $requestParams['locale'] = $this->parseJson($requestParams['locale']);
        }
      
        return array(get_class($this->entity) => $requestParams);
    }