Send the given API URL request.

@param string  $resource The API resource to search for.
@param integer $id       The id of a specific API resource.
@param array   $query    Array of search criteria to use in request.

@return null|DataWrapperInterface
323881
final private function send(string $resource, int $id = null, array $query = [])
    {
        $query['apikey'] = $this->publicApiKey;
        $query['ts'] = time();
        $query['hash'] = md5("{$query['ts']}{$this->privateApiKey}{$this->publicApiKey}");
        $cacheKey = urlencode($resource) . ($id !== null ? "/{$id}" : '') . '?' . http_build_query($query);
        $url = self::BASE_URL . $cacheKey;

        $response = $this->cache->get($cacheKey);
        if ($response === null) {
            $response = $this->guzzleClient->request('GET', $url, self::$guzzleRequestOptions);
        }

        if ($response->getStatusCode() !== 200) {
            return null;
        }

        $this->cache->set($cacheKey, $response, self::MAX_TTL);

        return DataWrapper::fromJson((string)$response->getBody());
    }
463125
public function query($entity, $query)
	{
		$retValue = array();

		try{
			$m = new MongoDB\Driver\Manager($this->url);
			$bulk = new MongoDB\Driver\BulkWrite;

			$options = [];

			$mQuery = new \MongoDB\Driver\Query($query, $options);
			$mCol = $this->db . "."  . $entity;
			$jsonData = $m->executeQuery($mCol, $mQuery);

			$retValue = $jsonData->toArray();
		}
		catch(Exception $e) {
			$this->_log->addError($e->getMessage());
		}

		return $retValue;
	}
1096751
public function postSearch(Request $request, $query = null)
    {

        $ids            = $request->get('ids');
        $local_override = $this->getParams($request, 'local_override', null);

        TranslationUtils::overrideLocal($local_override);

        if (empty($query)) {
            $query = $this->model;
        }

        if (!empty($ids)) {
            return response()->json($this->generateResultSearchByIds($request, $query, $ids));
        }

        return response()->json($this->generateResultSearch($request, $query));

    }
1045300
public function sendReadQuery($query, array $parameters = array())
    {
        return $this->sendCypherQuery($query, $parameters, $this->getReadConnection()->getAlias(), self::READ_QUERY);
    }
1068726
public JsonObject sendQuery(Map<String, Object> query)
      throws ExecutionException, InterruptedException, IOException {
    return sendQuery(sendQueryAsFuture(query));
  }
988926
public function sendSparqlSelectQuery($url, $query)
    {
        // because you can't just fire multiple requests with the same CURL class instance
        // we have to be creative and re-create the class everytime a request is to be send.
        // FYI: https://github.com/php-curl-class/php-curl-class/issues/326
        $class = get_class($this->httpClient);
        $phpVersionToOld = version_compare(phpversion(), '5.5.11', '<=');
        // only reinstance the class if its not mocked
        if ($phpVersionToOld && false === strpos($class, 'Mockery')) {
            $this->httpClient = new $class();
        }

        $this->httpClient->setHeader('Accept', 'application/sparql-results+json');
        $this->httpClient->setHeader('Content-Type', 'application/x-www-form-urlencoded');

        return $this->httpClient->post($url, array('query' => $query));
    }
973544
public function delete($url, array $query = [], array $data = [])
    {
        $url = $this->buildUrl($url, $query);
        $handle = $this->getHandler();

        curl_setopt_array($handle, [
            CURLOPT_CUSTOMREQUEST => 'DELETE',
            CURLOPT_POSTFIELDS => http_build_query($data),
        ]);

        return $this->run($handle, $url);
    }
1200772
public function sendRawRequest($model, $url, $method = 'GET', $data = null)
    {
        if ($model->debug) {
            echo '<font color="blue">'.
                htmlspecialchars("$method $url (".json_encode($data).')').
                '</font>';
        }
        $method = strtolower($method);

        $pest = $model->_table[$this->short_name];
        if ($data) {
            return $pest->$method($url, $data);
        } else {
            return $pest->$method($url);
        }
    }
1151965
public function route($route = null, array $params = array(), array $query = array())
    {
        return $this->toRoute($route, $params, $query);
    }
670654
public function sendQueryWithParameters($query, array $parameters = [])
    {
        $res = pg_send_query_params(
            $this->getHandler(),
            $query,
            $parameters
        );

        try {
            return $this
                ->testQuery($res, $query)
                ->getQueryResult($query)
                ;
        } catch (SqlException $e) {
            throw $e->setQueryParameters($parameters);
        }
    }
947019
public function sendSparqlUpdateQuery($url, $query)
    {
        // because you can't just fire multiple requests with the same CURL class instance
        // we have to be creative and re-create the class everytime a request is to be send.
        // FYI: https://github.com/php-curl-class/php-curl-class/issues/326
        $class = get_class($this->httpClient);
        $phpVersionToOld = version_compare(phpversion(), '5.5.11', '<=');
        // only reinstance the class if its not mocked
        if ($phpVersionToOld && false === strpos($class, 'Mockery')) {
            $this->httpClient = new $class;
        }

        // TODO extend Accept headers to further formats
        $this->httpClient->setHeader('Accept', 'application/sparql-results+json');
        $this->httpClient->setHeader('Content-Type', 'application/sparql-update');

        return $this->httpClient->get($url, array('query' => $query));
    }
214526
public function getEpisodesWithQuery(int $id, array $query): PaginatedResults
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureForEpisodesWithQuery($id, ['query' => $query]);

        return new PaginatedResults(
            $parent->getGenerator()->create($closure, BasicEpisode::class, $this->parent->getAcceptedLanguages(), true),
            $this->parent->getLastLinks()
        );
    }
259382
public function makeRequest(string $type = null, array $query = [])
    {
        if ($type) {
            $query[$type] = null;
        }

        $query['key'] = $this->apiKey;

        return $this->decodeResponse($this->client
            ->get($this->baseUrl, compact('query'))
            ->getBody()
            ->getContents());
    }
1088570
protected function sendRequest($request, $action = null, $params = array()) {
		$this->queryParams += $this->authProvider->queryParameters();
		
		if($action && $this->sendAsQueryParams($action->httpMethod())) {
			foreach ($params as $ns => $arr) {
				foreach ($arr as $k => $v) {
					$this->queryParams[ $ns."[$k]" ] = $v;
				}
			}
		}
		
		if(count($this->queryParams) > 0) {
			$url = $request->uri;
			$first = true;
			
			foreach($this->queryParams as $k => $v) {
				if($first) {
					$url .= '?';
					$first = false;
				} else $url .= '&';
				
				$url .= $k.'='.urlencode($v);
			}
			
			$request->uri = $url;
		}
		
		return $request->send();
	}
1342900
private function processApiQuery(array $query)
    {
        $query += array(
            'params' => array(),
            'id' => null
        );

        if (empty($query['method'])) {
            throw new MissingMethodException('Missing "method" parameter in query.');
        }

        if ($query['id'] !== null && !is_scalar($query['id'])) {
            throw new InvalidIdException('The "id" parameter must be a scalar.');
        }

        if (!is_scalar($query['method'])) {
            throw new InvalidMethodException('The "method" parameter must be a scalar.');
        }

        if (!is_array($query['params'])) {
            throw new InvalidParametersException('Input parameters must be a array.');
        }

        $this->requestId = $query['id'];

        $apiResponse = $this->handler->handle($query['method'], $query['params']);

        if ($apiResponse instanceof EmptyResponseInterface) {
            if ($apiResponse instanceof ResponseInterface) {
                return new SfResponse('', $apiResponse->getHttpStatusCode(), $apiResponse->getHeaders()->all());
            } else {
                return new SfResponse('');
            }
        }

        $data = array(
            'jsonrpc' => self::JSON_RPC_VERSION,
            'result' => $apiResponse->getData(),
            'id' => $query['id']
        );

        return new JsonResponse($data, $apiResponse->getHttpStatusCode(), $apiResponse->getHeaders()->all());
    }
874292
public function add($query, $resource, array $meta = [])
    {
        $query = static::clean($query);
        list($method, $uri) = explode(' ', $query);

        $this->routes[$query] = new Route($method, $uri, $resource, $meta);

        return $this;
    }
1062394
public function rawSelectById($id, Query $query = null, $join = 'all')
        {
            if (!$id) {
                return null;
            }

            if (!$query instanceof Query) {
                $query = new Query($this);
            }
            $query->where($this->id_column, $id);
            $query->setLimit(1);
            return $this->rawSelectOne($query, $join);
        }