File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ ///usr/bin/env jbang "$0" "$@" ; exit $?
2+
3+ //DEPS io.smallrye:smallrye-graphql-client-implementation-vertx:2.10.0
4+ //DEPS org.eclipse:yasson:2.0.4
5+
6+ //JAVA 17
7+
8+ import java .nio .file .Files ;
9+ import java .nio .file .Paths ;
10+
11+ import io .smallrye .graphql .client .dynamic .api .DynamicGraphQLClient ;
12+ import io .smallrye .graphql .client .Response ;
13+ import io .smallrye .graphql .client .vertx .dynamic .VertxDynamicGraphQLClientBuilder ;
14+
15+ import io .vertx .core .Vertx ;
16+
17+ class JavaClient {
18+ public static void main (String ... args ) throws Exception {
19+ String query = Files .readString (Paths .get ("work-items.query.graphql" ));
20+ Vertx vertx = Vertx .vertx ();
21+ DynamicGraphQLClient client = new VertxDynamicGraphQLClientBuilder ()
22+ .url ("https://gitlab.com/api/graphql" )
23+ .vertx (vertx )
24+ .build ();
25+ try {
26+ Response response = client .executeSync (query );
27+ System .out .println (response );
28+ } finally {
29+ client .close ();
30+ vertx .close ();
31+ }
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ == GraphQL queries
2+
3+ This folder contains some test GraphQL queries for gitlab.com
4+
5+ The queries can be exectued directly online: https://gitlab.com/-/graphql-explorer
6+
7+ GitLab GraphQL API: https://docs.gitlab.com/ee/api/graphql/
8+
9+ === Run with java
10+
11+ The script `JavaClient.java` contains the necessary code to run the `work-items.query.graphql` with a java client.
12+
13+ Just run `jbang JavaClient.java` to run the query and see the results.
You can’t perform that action at this time.
0 commit comments