Class GraphQLRequestBuilder

java.lang.Object
com.commercetools.api.models.graph_ql.GraphQLRequestBuilder
All Implemented Interfaces:
Builder<GraphQLRequest>

public class GraphQLRequestBuilder extends Object implements Builder<GraphQLRequest>
GraphQLRequestBuilder
Example to create an instance using the builder pattern

     GraphQLRequest graphQLRequest = GraphQLRequest.builder()
             .query("{query}")
             .build()
 
  • Constructor Details

    • GraphQLRequestBuilder

      public GraphQLRequestBuilder()
  • Method Details

    • query

      public GraphQLRequestBuilder query(String query)

      String representation of the Source Text of the Document that is specified in the Language section of the GraphQL specification.

      Parameters:
      query - value to be set
      Returns:
      Builder
    • operationName

      public GraphQLRequestBuilder operationName(@Nullable String operationName)

      Name of the operation, if you defined several operations in query.

      Parameters:
      operationName - value to be set
      Returns:
      Builder
    • variables

      JSON object that contains key-value pairs in which the keys are variable names and the values are variable values.

      Parameters:
      builder - function to build the variables value
      Returns:
      Builder
    • withVariables

      JSON object that contains key-value pairs in which the keys are variable names and the values are variable values.

      Parameters:
      builder - function to build the variables value
      Returns:
      Builder
    • variables

      public GraphQLRequestBuilder variables(@Nullable GraphQLVariablesMap variables)

      JSON object that contains key-value pairs in which the keys are variable names and the values are variable values.

      Parameters:
      variables - value to be set
      Returns:
      Builder
    • getQuery

      public String getQuery()

      String representation of the Source Text of the Document that is specified in the Language section of the GraphQL specification.

      Returns:
      query
    • getOperationName

      @Nullable public String getOperationName()

      Name of the operation, if you defined several operations in query.

      Returns:
      operationName
    • getVariables

      @Nullable public GraphQLVariablesMap getVariables()

      JSON object that contains key-value pairs in which the keys are variable names and the values are variable values.

      Returns:
      variables
    • build

      public GraphQLRequest build()
      builds GraphQLRequest with checking for non-null required values
      Specified by:
      build in interface Builder<GraphQLRequest>
      Returns:
      GraphQLRequest
    • buildUnchecked

      public GraphQLRequest buildUnchecked()
      builds GraphQLRequest without checking for non-null required values
      Returns:
      GraphQLRequest
    • of

      public static GraphQLRequestBuilder of()
      factory method for an instance of GraphQLRequestBuilder
      Returns:
      builder
    • of

      public static GraphQLRequestBuilder of(GraphQLRequest template)
      create builder for GraphQLRequest instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder