Class Builder

java.lang.Object
com.graphql_java_generator.client.request.Builder

public class Builder
extends java.lang.Object
This builder is provided for compatibility of existing code, that would have been developed before the 1.6 release. It allows to create ObjectResponse, that will define the content of the GraphQL request toward the server.
Author:
etienne-sf
  • Constructor Summary

    Constructors 
    Constructor Description
    Builder​(java.lang.Class<? extends AbstractGraphQLRequest> graphQLRequestClass)
    This Builder allows to build a Full request, that is request as you can execute in the graphiql interface.
    Builder​(java.lang.Class<? extends AbstractGraphQLRequest> graphQLRequestClass, java.lang.String fieldName, RequestType requestType, InputParameter... inputParams)
    This Builder allows to build a Partial request, that is a request for only one query/mutation/subscription.
  • Method Summary

    Modifier and Type Method Description
    ObjectResponse build()
    Returns the built ObjectResponse.
    Builder withQueryResponseDef​(java.lang.String queryResponseDef)
    Builds a ObjectResponse from a part of a GraphQL query.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Builder

      public Builder​(java.lang.Class<? extends AbstractGraphQLRequest> graphQLRequestClass)
      This Builder allows to build a Full request, that is request as you can execute in the graphiql interface.
      When calling the withQueryResponseDef(String), a new AbstractGraphQLRequest is created by calling its AbstractGraphQLRequest(String) constructor.
      Parameters:
      graphQLRequestClass - The graphQLRequestClass inherits from AbstractGraphQLRequest, and contains the generated context that allows proper GraphQL request executions
    • Builder

      public Builder​(java.lang.Class<? extends AbstractGraphQLRequest> graphQLRequestClass, java.lang.String fieldName, RequestType requestType, InputParameter... inputParams)
      This Builder allows to build a Partial request, that is a request for only one query/mutation/subscription.
      When calling the withQueryResponseDef(String), the query request can be something like the one below, based on the hero query of the star wars schema:
       {id appearsIn friends {name friends {friends{id name appearsIn}}}}
       
      This defines only the part of the GraphQL request that defines the expected response content from the GraphQL server.
      Parameters:
      graphQLRequestClass - The graphQLRequestClass inherits from AbstractGraphQLRequest, and contains the generated context that allows proper GraphQL request executions
      fieldName - The query/mutation/subscription name, as defined in the GraphQL schema
      requestType - The request type allows to search fieldName in the query or in the mutation or the subscription
      inputParams - The input parameters for this query/mutation/subscription
  • Method Details