Interface QueryExecutor
-
@ProviderType public interface QueryExecutor
AQueryExecutor
service allows consumers to validate and execute GraphQL queries directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Map<String,Object>
execute(@NotNull String query, @NotNull Map<String,Object> variables, @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull String[] selectors)
Executes the passedquery
.ValidationResult
validate(@NotNull String query, @NotNull Map<String,Object> variables, @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull String[] selectors)
Validates the passedquery
andvariables
, by checking if the query obeys the known schemas.
-
-
-
Method Detail
-
validate
ValidationResult validate(@NotNull @NotNull String query, @NotNull @NotNull Map<String,Object> variables, @NotNull @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull @NotNull String[] selectors)
Validates the passedquery
andvariables
, by checking if the query obeys the known schemas.- Parameters:
query
- the queryvariables
- the query's variables; can be an emptyMap
if the query doesn't accept variablesqueryResource
- the current resource, used as the root for the queryselectors
- potential selectors used to select the schema applicable to the passedquery
- Returns:
- {code true} if the
query
is valid,false
otherwise
-
execute
@NotNull @NotNull Map<String,Object> execute(@NotNull @NotNull String query, @NotNull @NotNull Map<String,Object> variables, @NotNull @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull @NotNull String[] selectors)
Executes the passedquery
.- Parameters:
query
- the queryvariables
- the query's variables; can be an emptyMap
if the query doesn't accept variablesqueryResource
- the current resource, used as the root for the queryselectors
- potential selectors used to select the schema applicable to the passedquery
- Returns:
- a
Map
representing the query's result - Throws:
SlingGraphQLException
- if the execution of the query leads to any issues
-
-