-
Notifications
You must be signed in to change notification settings - Fork 0
/
Client.java
44 lines (37 loc) · 1.46 KB
/
Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package run;
import java.util.List;
import io.smallrye.graphql.client.Response;
import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient;
import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder;
import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder;
import io.vertx.core.Vertx;
import superheroes.api.SuperheroesClientApi;
import superheroes.model.City;
import superheroes.model.Superhero;
public class Client {
public static void main(String... args) throws Exception {
SuperheroesClientApi api = TypesafeGraphQLClientBuilder.newBuilder().build(SuperheroesClientApi.class);
List<City> allCities = api.allCities();
System.out.println("response: " + allCities);
List<Superhero> allSuperheroes = api.allSuperheroes();
System.out.println("response: " + allSuperheroes);
// Vertx vertx = Vertx.vertx();
// DynamicGraphQLClient client = new VertxDynamicGraphQLClientBuilder()
// .url("https://countries.trevorblades.com")
// .vertx(vertx)
// .build();
// try {
// Response response = client.executeSync("""
// query {
// countries {
// name
// }
// }
// """);
// System.out.println(response);
// } finally {
// client.close();
// vertx.close();
// }
}
}