Class DgsGraphQlClient
java.lang.Object
org.springframework.graphql.client.DgsGraphQlClient
Simple wrapper around a
GraphQlClient
that prepares the request
from classes generated with the
DGS Code Generation library.
GraphQlClient client = ... ; DgsGraphQlClient dgsClient = DgsGraphQlClient.create(client); List<Book> books = dgsClient.request(new BooksGraphQLQuery()) .projection(new BooksProjectionRoot<>().id().name()) .retrieveSync() .toEntityList(Book.class);
- Since:
- 1.3.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
Declare options to gather input for a GraphQL request and execute it. -
Method Summary
Modifier and TypeMethodDescriptionstatic DgsGraphQlClient
create
(GraphQlClient client) Create instance that wraps the givenGraphQlClient
.Return the wrappedGraphQlClient
to delegate to.request
(com.netflix.graphql.dgs.client.codegen.GraphQLQuery query) Start defining a GraphQL request for the givenGraphQLQuery
.
-
Method Details
-
getGraphQlClient
Return the wrappedGraphQlClient
to delegate to. -
request
public DgsGraphQlClient.RequestSpec request(com.netflix.graphql.dgs.client.codegen.GraphQLQuery query) Start defining a GraphQL request for the givenGraphQLQuery
.- Parameters:
query
- the GraphQL query
-
create
Create instance that wraps the givenGraphQlClient
.- Parameters:
client
- the client to delegate to
-