GDS\Gateway\RESTv1::gql PHP Method

gql() public method

POST /v1/projects/{projectId}:runQuery
public gql ( string $str_gql, null | array $arr_params = null ) : mixed
$str_gql string
$arr_params null | array
return mixed
    public function gql($str_gql, $arr_params = null)
    {
        // Build the query
        $obj_request = (object) ['gqlQuery' => (object) ['allowLiterals' => true, 'queryString' => $str_gql]];
        $this->applyPartition($obj_request);
        $this->applyTransaction($obj_request);
        if (is_array($arr_params)) {
            $this->addParamsToQuery($obj_request->gqlQuery, $arr_params);
        }
        // Run
        $this->executePostRequest('runQuery', $obj_request);
        // Extract results
        $arr_mapped_results = [];
        if (isset($this->obj_last_response->batch->entityResults) && is_array($this->obj_last_response->batch->entityResults)) {
            $arr_mapped_results = $this->createMapper()->mapFromResults($this->obj_last_response->batch->entityResults);
        }
        $this->obj_schema = null;
        // Consume Schema
        return $arr_mapped_results;
    }