Interface QueryExecutor
-
@ProviderType public interface QueryExecutorAQueryExecutorservice 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.ValidationResultvalidate(@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 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 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
-
-