diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..053be0a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+conf
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..a0769fe
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,18 @@
+{
+ "configurations": [
+ {
+ "type": "java",
+ "name": "CodeLens (Launch) - CreateAgent",
+ "request": "launch",
+ "mainClass": "CreateAgent",
+ "projectName": "dialogflow-fun"
+ },
+ {
+ "type": "java",
+ "name": "CodeLens (Launch) - DialogFlow",
+ "request": "launch",
+ "mainClass": "DialogFlow",
+ "projectName": "dialogflow-fun"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..e016ac0
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,4 @@
+{
+ "java.configuration.updateBuildConfiguration": "automatic",
+ "maven.view": "hierarchical"
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 5df02c4..88a0d47 100644
--- a/README.md
+++ b/README.md
@@ -3,3 +3,14 @@
A simple project using dialog flow
- Google Cloud project name : [dialogflow-fun](https://console.cloud.google.com/apis/library?project=dialogflow-fun)
+
+* Create google cloud project
+* Create DialogFlow agent coupled to project [dialogflow-fun-agent](https://dialogflow.cloud.google.com/#/agent/ac522b80-e75b-40cd-9493-269fbb4ef634/intents)
+* Create service account and set environment variable.
+
+## Useful references
+
+- [Reference guide](https://cloud.google.com/dialogflow/docs/reference/libraries/java)
+- [Full library reference](https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/dialogflow/v2/package-summary.html)
+- [Maven dependency](https://search.maven.org/artifact/com.google.cloud/google-cloud-dialogflow/0.114.0-alpha/jar)
+- [Authentication](https://cloud.google.com/docs/authentication/getting-started)
diff --git a/dialogflow-fun-java/.classpath b/dialogflow-fun-java/.classpath
new file mode 100644
index 0000000..92b9cb8
--- /dev/null
+++ b/dialogflow-fun-java/.classpath
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dialogflow-fun-java/.gitignore b/dialogflow-fun-java/.gitignore
index dc7bdeb..74d1bd0 100644
--- a/dialogflow-fun-java/.gitignore
+++ b/dialogflow-fun-java/.gitignore
@@ -20,4 +20,6 @@
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
\ No newline at end of file
+hs_err_pid*
+
+conf
\ No newline at end of file
diff --git a/dialogflow-fun-java/.project b/dialogflow-fun-java/.project
new file mode 100644
index 0000000..5152aee
--- /dev/null
+++ b/dialogflow-fun-java/.project
@@ -0,0 +1,23 @@
+
+
+ dialogflow-fun
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/dialogflow-fun-java/.settings/org.eclipse.jdt.apt.core.prefs b/dialogflow-fun-java/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 0000000..d4313d4
--- /dev/null
+++ b/dialogflow-fun-java/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/dialogflow-fun-java/.settings/org.eclipse.jdt.core.prefs b/dialogflow-fun-java/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..46235dc
--- /dev/null
+++ b/dialogflow-fun-java/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.compliance=11
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=11
diff --git a/dialogflow-fun-java/.settings/org.eclipse.m2e.core.prefs b/dialogflow-fun-java/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/dialogflow-fun-java/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/dialogflow-fun-java/pom.xml b/dialogflow-fun-java/pom.xml
index 4caab6b..347587c 100644
--- a/dialogflow-fun-java/pom.xml
+++ b/dialogflow-fun-java/pom.xml
@@ -1,12 +1,27 @@
-
-
- 4.0.0
+
+
+ 4.0.0
- fr.lengrand
- dialogflow-fun
- 1.0-SNAPSHOT
+ fr.lengrand
+ dialogflow-fun
+ 1.0-SNAPSHOT
+
+ 11
+ 11
+ 11
+
+
+
+ com.google.api-client
+ google-api-client
+ 1.30.2
+
+
+ com.google.cloud
+ google-cloud-dialogflow
+ 0.114.0-alpha
+
+
\ No newline at end of file
diff --git a/dialogflow-fun-java/src/main/java/CreateAgent.java b/dialogflow-fun-java/src/main/java/CreateAgent.java
new file mode 100644
index 0000000..1de41eb
--- /dev/null
+++ b/dialogflow-fun-java/src/main/java/CreateAgent.java
@@ -0,0 +1,95 @@
+import java.io.IOException;
+import java.util.List;
+
+import com.google.cloud.dialogflow.v2beta1.EntityType;
+import com.google.cloud.dialogflow.v2beta1.EntityTypeName;
+import com.google.cloud.dialogflow.v2beta1.EntityTypesClient;
+import com.google.cloud.dialogflow.v2beta1.ProjectAgentName;
+import com.google.cloud.dialogflow.v2beta1.Agent;
+import com.google.cloud.dialogflow.v2beta1.AgentsClient;
+import com.google.cloud.dialogflow.v2beta1.ProjectName;
+import com.google.cloud.dialogflow.v2beta1.EntityType.Entity;
+
+public class CreateAgent {
+
+ private static final String GOOGLE_AUTH_ENV_NAME = "GOOGLE_APPLICATION_CREDENTIALS";
+ private static final String PROJECT_NAME = "dialogflow-fun";
+ private static final String AGENT_NAME = "dialogflow-fun-agent";
+ private static final String AGENT_ID = "ac522b80-e75b-40cd-9493-269fbb4ef634";
+ private static final String ENTITY_TYPE_ID = "Developer";
+
+ public static void main(String[] args) {
+
+ if (!googleAuthOk()) {
+ System.out.println("Error with Google Authentication. Exiting...");
+ System.exit(0);
+ }
+
+ getAgentInfo();
+ getEntitiesInfo();
+
+ System.out.println("Done");
+ }
+
+ public static void getEntitiesInfo() {
+
+ // ENTITY TYPES
+ // https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/dialogflow/v2/package-summary.html
+ // * **System** - entities that are defined by the Dialogflow API for common
+ // data types such as date, time, currency, and so on. A system entity is
+ // represented by the `EntityType` type.
+ // * **Developer** - entities that are defined by you that represent actionable
+ // data that is meaningful to your application. For example, you could define a
+ // `pizza.sauce` entity for red or white pizza sauce, a `pizza.cheese` entity
+ // for the different types of cheese on a pizza, a `pizza.topping` entity for
+ // different toppings, and so on. A developer entity is represented by the
+ // `EntityType` type.
+ // * **User** - entities that are built for an individual user such as
+ // favorites, preferences, playlists, and so on. A user entity is represented by
+ // the [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] type.
+
+ System.out.println("==========");
+ System.out.println("Getting Entities info");
+
+ try {
+ EntityTypesClient entityTypesClient = EntityTypesClient.create();
+ ProjectAgentName parent = ProjectAgentName.of(PROJECT_NAME);
+ for (EntityType entityType : entityTypesClient.listEntityTypes(parent).iterateAll()) {
+ System.out.println(entityType.getDisplayName());
+ List entities = entityType.getEntitiesList();
+ entities.forEach(CreateAgent::printEntity);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("==========");
+
+ }
+
+ public static void printEntity(Entity entity) {
+ System.out.println(entity.getValue());
+ }
+
+ public static void getAgentInfo() {
+ System.out.println("==========");
+ System.out.println("Getting Agent info");
+
+ try {
+ AgentsClient agentsClient = AgentsClient.create();
+ Agent myAgent = agentsClient.getAgent(ProjectName.of("dialogflow-fun"));
+ System.out.println(myAgent.getDisplayName());
+ System.out.println(myAgent.getDescription());
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("==========");
+ }
+
+ public static boolean googleAuthOk() {
+ return System.getenv().get(GOOGLE_AUTH_ENV_NAME) != null;
+ }
+}
diff --git a/dialogflow-fun-java/target/maven-archiver/pom.properties b/dialogflow-fun-java/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..dbec00b
--- /dev/null
+++ b/dialogflow-fun-java/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Sun Oct 13 17:08:23 CEST 2019
+groupId=fr.lengrand
+artifactId=dialogflow-fun
+version=1.0-SNAPSHOT
diff --git a/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..249d9df
--- /dev/null
+++ b/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,2 @@
+CreateAgent.class
+DialogFlow.class
diff --git a/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..62b5bf2
--- /dev/null
+++ b/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,2 @@
+/Users/jlengrand/IdeaProjects/dialogflow-fun/dialogflow-fun-java/src/main/java/DialogFlow.java
+/Users/jlengrand/IdeaProjects/dialogflow-fun/dialogflow-fun-java/src/main/java/CreateAgent.java
diff --git a/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/dialogflow-fun-java/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29