diff --git a/pom.xml b/pom.xml
index aff2f9e..b3f5740 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,7 @@
nodes
+ samples/java-sample
samples/kotlin-sample
samples/scala-sample
diff --git a/samples/java-sample/pom.xml b/samples/java-sample/pom.xml
new file mode 100644
index 0000000..23aa2ed
--- /dev/null
+++ b/samples/java-sample/pom.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ parent
+ io.aexp.nodes.graphql
+ 0.5.0
+ ../../pom.xml
+
+ 4.0.0
+
+ java-sample
+ Java Sample
+
+
+
+ ${project.groupId}
+ nodes
+ ${project.version}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.0
+
+ 11
+
+
+
+
+
+
+
diff --git a/samples/java-sample/src/main/java/Main.java b/samples/java-sample/src/main/java/Main.java
new file mode 100644
index 0000000..e6b2ddd
--- /dev/null
+++ b/samples/java-sample/src/main/java/Main.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018 American Express Travel Related Services Company, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.HashMap;
+
+import io.aexp.nodes.graphql.Argument;
+import io.aexp.nodes.graphql.Arguments;
+import io.aexp.nodes.graphql.GraphQLRequestEntity;
+import io.aexp.nodes.graphql.GraphQLTemplate;
+import io.aexp.nodes.graphql.Variable;
+import models.User;
+
+public class Main {
+
+ // https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql
+ private static final String YOUR_AUTH_TOKEN = "eeb7987aef9ccd7440a49cae2acc7f58bb415059";
+
+ public static void main(String[] args) throws Exception {
+ var headers = new HashMap();
+ headers.put("Authorization", "bearer " + YOUR_AUTH_TOKEN);
+
+ var template = new GraphQLTemplate();
+ var requestEntity = GraphQLRequestEntity.Builder()
+ .url("https://api.github.com/graphql")
+ .request(User.class)
+ .headers(headers)
+ .arguments(new Arguments("user", new Argument<>("login", "chemdrew")))
+ .variables(new Variable("isFork", false))
+ .scalars(BigDecimal.class, BigInteger.class)
+ .build();
+ var responseEnitity = template.query(requestEntity, User.class);
+
+ System.out.println("request: " + requestEntity.getRequest());
+ System.out.println("response: " + responseEnitity.getResponse());
+ }
+
+}
diff --git a/samples/java-sample/src/main/java/models/RepositoryConnection.java b/samples/java-sample/src/main/java/models/RepositoryConnection.java
new file mode 100644
index 0000000..10a89a0
--- /dev/null
+++ b/samples/java-sample/src/main/java/models/RepositoryConnection.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018 American Express Travel Related Services Company, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package models;
+
+public class RepositoryConnection {
+ private int totalCount;
+
+ public int getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(int totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("RepositoryConnection(totalCount=%d)", totalCount);
+ }
+
+}
diff --git a/samples/java-sample/src/main/java/models/User.java b/samples/java-sample/src/main/java/models/User.java
new file mode 100644
index 0000000..54ae194
--- /dev/null
+++ b/samples/java-sample/src/main/java/models/User.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018 American Express Travel Related Services Company, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package models;
+
+import io.aexp.nodes.graphql.annotations.GraphQLArgument;
+import io.aexp.nodes.graphql.annotations.GraphQLProperty;
+import io.aexp.nodes.graphql.annotations.GraphQLVariable;
+
+@GraphQLProperty(name = "user", arguments = { @GraphQLArgument(name = "login") })
+public class User {
+ private String name;
+ private String location;
+ @GraphQLVariable(name = "isFork", scalar = "Boolean!")
+ private RepositoryConnection repositories;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public RepositoryConnection getRepositories() {
+ return repositories;
+ }
+
+ public void setRepositories(RepositoryConnection repositories) {
+ this.repositories = repositories;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("name=%s, location=%s, repositories=%s", name, location, repositories);
+ }
+
+}