Interface GraphQlClient
- All Known Subinterfaces:
HttpGraphQlClient
,HttpSyncGraphQlClient
,RSocketGraphQlClient
,WebGraphQlClient
,WebSocketGraphQlClient
- All Known Implementing Classes:
AbstractDelegatingGraphQlClient
public interface GraphQlClient
Define a workflow to execute GraphQL requests that is independent of the
underlying transport.
For most cases, use a transport specific extension:
Alternatively, create an instance with any other transport via
builder(GraphQlTransport)
. Or create a transport specific extension
similar to HTTP and WebSocket.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
GraphQlClient.BaseBuilder<B extends GraphQlClient.BaseBuilder<B>>
Base builder for creating and initializing aGraphQlClient
.static interface
GraphQlClient.Builder<B extends GraphQlClient.Builder<B>>
Builder to create aGraphQlClient
with a non-blocking execution chain and transport.static interface
Declare options to gather input for a GraphQL request and execute it.static interface
Declares options to decode a field in a single response.static interface
Declares options to decode a field in each response of a subscription.static interface
Declares options to decode a field in a single response.static interface
GraphQlClient.SyncBuilder<B extends GraphQlClient.SyncBuilder<B>>
Builder to create aGraphQlClient
instance with a synchronous execution chain and transport. -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQlClient.Builder<?>
builder
(GraphQlTransport transport) Create a builder with the given customGraphQlTransport
.Start defining a GraphQL request with the given document, which is the textual representation of an operation (or operations) to perform, including selection sets and fragments.documentName
(String name) Variant ofdocument(String)
that uses the given key to resolve the GraphQL document from a file with the help of the configuredDocumentSource
.mutate()
Return a builder initialized from the configuration of "this" client to use to build a new, independently configured client instance.
-
Method Details
-
document
Start defining a GraphQL request with the given document, which is the textual representation of an operation (or operations) to perform, including selection sets and fragments.- Parameters:
document
- the document for the request- Returns:
- spec to further define or execute the request
-
documentName
Variant ofdocument(String)
that uses the given key to resolve the GraphQL document from a file with the help of the configuredDocumentSource
.- Parameters:
name
- the document name- Throws:
IllegalArgumentException
- if the content could not be loaded
-
mutate
GraphQlClient.BaseBuilder<?> mutate()Return a builder initialized from the configuration of "this" client to use to build a new, independently configured client instance. -
builder
Create a builder with the given customGraphQlTransport
.For most cases, use a transport specific extension such as
HttpGraphQlClient
orWebSocketGraphQlClient
. This method is for use with a customGraphQlTransport
.- Parameters:
transport
- the transport to execute requests with- Returns:
- the builder for further initialization
-