Interface QueryExecutor
@ProviderType
public interface QueryExecutor
A
QueryExecutor service allows consumers to validate and execute GraphQL queries directly.-
Method Summary
Modifier and TypeMethodDescriptionexecute(@NotNull String query, @NotNull Map<String, Object> variables, @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull String[] selectors) Executes the passedquery.validate(@NotNull String query, @NotNull Map<String, Object> variables, @NotNull org.apache.sling.api.resource.Resource queryResource, @NotNull String[] selectors) Validates the passedqueryandvariables, by checking if the query obeys the known schemas.
-
Method Details
-
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 passedqueryandvariables, by checking if the query obeys the known schemas.- Parameters:
query- the queryvariables- the query's variables; can be an emptyMapif 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
queryis valid,falseotherwise
-
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 emptyMapif 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
Maprepresenting the query's result - Throws:
SlingGraphQLException- if the execution of the query leads to any issues
-