Helper class to execute GraphQL queries. It provides both synchronous and asynchronous methods to execute queries.

Constructors

Methods

  • Execute an asynchronous GraphQL query using the specified parameters and return a Promise that will be resolved with the result

    Parameters

    • parameters: any

      the parameters can contain the following keys:

                     query (string) : the GraphQL query to be executed 
      operationName (string) : the GraphQL operation name
      variables: the variables as a JSON string or a Map<String, Object>
      renderContext (RenderContext) : the render context
      if the renderContext is null, a request will be created with the parameters that were passed,
      otherwise the request from the renderContext will be used.

    Returns Promise<any>

    a Promise that will be resolved with the result of the query as a JSON structure or with an error message if there was an error executing the query

  • Execute a synchronous GraphQL query using the specified parameters and return the result

    Parameters

    • parameters: any

      the parameters can contain the following keys:

                     query (string) : the GraphQL query to be executed 
      operationName (string) : the GraphQL operation name
      variables: the variables as a JSON string or a Map<String, Object>
      renderContext (RenderContext) : the render context
      if the renderContext is null, a request will be created with the parameters that were passed,
      otherwise the request from the renderContext will be used.

    Returns any

    the result of the query as a JSON structure

    Throws

    ServletException

    Throws

    IOException