Interface GraphQlClient.RequestSpec

Enclosing interface:
GraphQlClient

public static interface GraphQlClient.RequestSpec
Declare options to gather input for a GraphQL request and execute it.
  • Method Details

    • operationName

      GraphQlClient.RequestSpec operationName(@Nullable String operationName)
      Set the name of the operation in the document to execute, if the document contains multiple operations.
      Parameters:
      operationName - the operation name
      Returns:
      this request spec
    • variable

      Add a value for a variable defined by the operation.
      Parameters:
      name - the variable name
      value - the variable value
      Returns:
      this request spec
    • variables

      GraphQlClient.RequestSpec variables(Map<String,Object> variables)
      Add all given values for variables defined by the operation.
      Parameters:
      variables - the variable values
      Returns:
      this request spec
    • extension

      Add a value for a protocol extension.
      Parameters:
      name - the protocol extension name
      value - the extension value
      Returns:
      this request spec
    • extensions

      GraphQlClient.RequestSpec extensions(Map<String,Object> extensions)
      Add all given protocol extensions.
      Parameters:
      extensions - the protocol extensions
      Returns:
      this request spec
    • attribute

      GraphQlClient.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 name of the attribute
      value - the attribute value
      Returns:
      this builder
    • attributes

      GraphQlClient.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 - consumer to customize attributes with
      Returns:
      this builder
    • retrieveSync

      Shortcut for executeSync() with a field path to decode from.

      If you want to decode the full data instead, use:

       client.document("..").executeSync()
       
      Parameters:
      path - the field path
      Returns:
      a spec with decoding options
      Throws:
      FieldAccessException - if the field has any field errors, including errors at, above or below the field path.
      Since:
      1.3.0
    • retrieve

      Shortcut for execute() with a field path to decode from.

      If you want to decode the full data instead, use:

       client.document("..").execute().map(response -> ...)
       
      Parameters:
      path - the field path
      Returns:
      a spec with decoding options
      Throws:
      FieldAccessException - if the field has any field errors, including errors at, above or below the field path.
    • retrieveSubscription

      GraphQlClient.RetrieveSubscriptionSpec retrieveSubscription(String path)
      Shortcut for executeSubscription() with a field path to decode from for each result.

      If you want to decode the full data, use:

       client.document("..").executeSubscription().map(response -> ...)
       
      Parameters:
      path - the field path
      Returns:
      a spec with decoding options
    • executeSync

      ClientGraphQlResponse executeSync()
      Execute request with a single response, e.g. "query" or "mutation", and return a response for further options.
      Returns:
      a ClientGraphQlResponse for further decoding of the response.
      Throws:
      GraphQlTransportException - in case of errors due to transport or other issues related to encoding and decoding the request and response.
      Since:
      1.3.0
    • execute

      reactor.core.publisher.Mono<ClientGraphQlResponse> execute()
      Execute request with a single response, e.g. "query" or "mutation", and return a response for further options.
      Returns:
      a Mono with a ClientGraphQlResponse for further decoding of the response. The Mono may end with an error due to transport level issues.
    • executeSubscription

      reactor.core.publisher.Flux<ClientGraphQlResponse> executeSubscription()
      Execute a "subscription" request and return a stream of responses.
      Returns:
      a Flux with responses that provide further options for decoding of each response. The Flux may terminate as follows:
      • Completes if the subscription completes before the connection is closed.
      • SubscriptionErrorException if the subscription ends with an error.
      • WebSocketDisconnectedException if the connection is closed or lost before the stream terminates.
      • Exception for connection and GraphQL session initialization issues.

      The Flux may be cancelled to notify the server to end the subscription stream.