Search in sources :

Example 1 with SuperHero

use of examples.typesafeclient.SuperHero in project smallrye-graphql by smallrye.

the class MyClientUsage method execute.

public void execute() throws ExecutionException, InterruptedException {
    Document document = document(operation(field("allHeroesIn", args(arg("location", "Outer Space")), field("name"), field("superPowers"))));
    // <2>
    Response response = client.executeSync(document);
    // <3>
    JsonArray heroesArray = response.getData().getJsonArray("allHeroesIn");
    // <4>
    List<SuperHero> heroes = response.getList(SuperHero.class, "allHeroesIn");
}
Also used : Response(io.smallrye.graphql.client.Response) JsonArray(javax.json.JsonArray) SuperHero(examples.typesafeclient.SuperHero) Document(io.smallrye.graphql.client.core.Document)

Aggregations

SuperHero (examples.typesafeclient.SuperHero)1 Response (io.smallrye.graphql.client.Response)1 Document (io.smallrye.graphql.client.core.Document)1 JsonArray (javax.json.JsonArray)1