Interface GraphQlClient.RequestSpec
- Enclosing interface:
- GraphQlClient
public static interface GraphQlClient.RequestSpec
Declare options to gather input for a GraphQL request and execute it.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionSet a client request attribute.attributes(Consumer<Map<String, Object>> attributesConsumer) Manipulate the client request attributes.reactor.core.publisher.Mono<ClientGraphQlResponse> execute()Execute request with a single response, e.g.reactor.core.publisher.Flux<ClientGraphQlResponse> Execute a "subscription" request and return a stream of responses.Execute request with a single response, e.g.Add a value for a protocol extension.extensions(Map<String, Object> extensions) Add all given protocol extensions.operationName(@Nullable String operationName) Set the name of the operation in thedocumentto execute, if the document contains multiple operations.Shortcut forexecute()with a field path to decode from.retrieveSubscription(String path) Shortcut forexecuteSubscription()with a field path to decode from for each result.retrieveSync(String path) Shortcut forexecuteSync()with a field path to decode from.Add a value for a variable defined by the operation.Add all given values for variables defined by the operation.
- 
Method Details- 
operationNameSet the name of the operation in thedocumentto execute, if the document contains multiple operations.- Parameters:
- operationName- the operation name
- Returns:
- this request spec
 
- 
variableAdd a value for a variable defined by the operation.- Parameters:
- name- the variable name
- value- the variable value
- Returns:
- this request spec
 
- 
variablesAdd all given values for variables defined by the operation.- Parameters:
- variables- the variable values
- Returns:
- this request spec
 
- 
extensionAdd a value for a protocol extension.- Parameters:
- name- the protocol extension name
- value- the extension value
- Returns:
- this request spec
 
- 
extensionsAdd all given protocol extensions.- Parameters:
- extensions- the protocol extensions
- Returns:
- this request spec
 
- 
attributeSet a client request attribute.This is purely for client side request processing, i.e. available throughout the GraphQlClientInterceptorchain but not sent.- Parameters:
- name- the name of the attribute
- value- the attribute value
- Returns:
- this builder
 
- 
attributesManipulate 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
 
- 
retrieveSyncShortcut forexecuteSync()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
 
- 
retrieveShortcut forexecute()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.
 
- 
retrieveSubscriptionShortcut forexecuteSubscription()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
 
- 
executeSyncClientGraphQlResponse executeSync()Execute request with a single response, e.g. "query" or "mutation", and return a response for further options.- Returns:
- a ClientGraphQlResponsefor 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
 
- 
executereactor.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 Monowith aClientGraphQlResponsefor further decoding of the response. TheMonomay end with an error due to transport level issues.
 
- 
executeSubscriptionreactor.core.publisher.Flux<ClientGraphQlResponse> executeSubscription()Execute a "subscription" request and return a stream of responses.- Returns:
- a Fluxwith responses that provide further options for decoding of each response. TheFluxmay terminate as follows:- Completes if the subscription completes before the connection is closed.
- SubscriptionErrorExceptionif the subscription ends with an error.
- WebSocketDisconnectedExceptionif the connection is closed or lost before the stream terminates.
- Exception for connection and GraphQL session initialization issues.
 The Fluxmay be cancelled to notify the server to end the subscription stream.
 
 
-