Interface GraphQlClient
- All Known Subinterfaces:
HttpGraphQlClient
,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.Builder<B extends GraphQlClient.Builder<B>>
Defines a builder for creatingGraphQlClient
instances.static interface
Declare options to gather input for a GraphQL request and execute it.static interface
Declares options to decode a field for a single response operation.static interface
Declares options to decode a field in each response of a subscription. -
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
.- Throws:
IllegalArgumentException
- if the content could not be loaded
-
mutate
GraphQlClient.Builder<?> 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
-