Class DgsGraphQlClient.RequestSpec

java.lang.Object
org.springframework.graphql.client.DgsGraphQlClient.RequestSpec
Enclosing class:
DgsGraphQlClient

public final class DgsGraphQlClient.RequestSpec extends Object
Declare options to gather input for a GraphQL request and execute it.
Since:
1.3.0
Author:
Rossen Stoyanchev
  • Method Details

    • queryAlias

      public DgsGraphQlClient.RequestSpec queryAlias(String queryAlias)
      Configure an alias for the current query.
      Parameters:
      queryAlias - the alias for this query
      Returns:
      the same builder instance
    • projection

      public DgsGraphQlClient.RequestSpec projection(com.netflix.graphql.dgs.client.codegen.BaseProjectionNode projectionNode)
      Provide a BaseProjectionNode that defines the response selection set.
      Parameters:
      projectionNode - the response selection set
      Returns:
      the same builder instance
    • coercing

      public DgsGraphQlClient.RequestSpec coercing(Class<?> scalarType, Coercing<?,?> coercing)
      Configure Coercing for serialization of scalar types.
      Parameters:
      scalarType - the scalar type
      coercing - the coercing function for this scalar
      Returns:
      the same builder instance
    • coercing

      public DgsGraphQlClient.RequestSpec coercing(Map<Class<?>, Coercing<?,?>> coercingMap)
      Configure Coercing for serialization of scalar types.
      Parameters:
      coercingMap - the map of coercing function
      Returns:
      the same builder instance
    • attribute

      public DgsGraphQlClient.RequestSpec attribute(String name, Object value)
      Set a client request attribute.

      This is purely for client side request processing, i.e. available throughout the GraphQlClientInterceptor chain but not sent.

      Parameters:
      name - the attribute name
      value - the attribute value
      Returns:
      the same builder instance
    • attributes

      public DgsGraphQlClient.RequestSpec attributes(Consumer<Map<String,Object>> attributesConsumer)
      Manipulate the client request attributes. The map provided to the consumer is "live", so the consumer can inspect and modify attributes accordingly.
      Parameters:
      attributesConsumer - the consumer that will manipulate request attributes
      Returns:
      the same builder instance
    • request

      public DgsGraphQlClient.RequestSpec request(com.netflix.graphql.dgs.client.codegen.GraphQLQuery query)
      Define an additional GraphQL request for the given GraphQLQuery, resulting in a GraphQLMultiQueryRequest being sent.
      Parameters:
      query - the GraphQL query
      See Also:
    • retrieveSync

      public GraphQlClient.RetrieveSyncSpec retrieveSync()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.retrieveSync(String) for details. The path used is the operationName.

    • retrieveSync

      public GraphQlClient.RetrieveSyncSpec retrieveSync(String path)
      Variant of executeSync() with explicit path relative to the "data" key.
      Parameters:
      path - the JSON path relative to the "data" key
    • retrieve

      public GraphQlClient.RetrieveSpec retrieve()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.retrieve(String) for details. The path used is the operationName.

    • retrieve

      public GraphQlClient.RetrieveSpec retrieve(String path)
      Variant of retrieve() with explicit path relative to the "data" key.
      Parameters:
      path - the JSON path relative to the "data" key
    • retrieveSubscription

      public GraphQlClient.RetrieveSubscriptionSpec retrieveSubscription()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.retrieveSubscription(String) for details. The path used is the operationName.

    • executeSync

      public ClientGraphQlResponse executeSync()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.executeSync() for details.

    • execute

      public reactor.core.publisher.Mono<ClientGraphQlResponse> execute()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.execute() for details.

    • executeSubscription

      public reactor.core.publisher.Flux<ClientGraphQlResponse> executeSubscription()
      Create GraphQLQueryRequest, serialize it to a String document to send, and delegate to the wrapped GraphQlClient.

      See Javadoc of delegate method GraphQlClient.RequestSpec.executeSubscription() for details.