Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8c1edfd
remove unused list_* samples
Strykrol Mar 24, 2020
3caa81a
Merge branch 'master' into snippetCleanup
lesv Mar 25, 2020
96e34ca
dialogflow: delete unused context management samples
Strykrol Apr 3, 2020
be7df0d
dialogflow: delete unused detect intent with model selection samples
Strykrol Apr 3, 2020
a921583
dialogflow: delete unused entity type management samples
Strykrol Apr 3, 2020
acef492
dialogflow: delete unused knowledgebase management samples
Strykrol Apr 3, 2020
ca5f614
dialogflow: delete unused session entity type management samples
Strykrol Apr 3, 2020
5c68ccd
Merge branch 'snippetCleanup' of https://github.com/Strykrol/java-doc…
Strykrol Apr 3, 2020
cf6b2f6
Create CreateDocumentTest
nnegrey Apr 3, 2020
b31ade6
Create CreateEntityTest
nnegrey Apr 3, 2020
a3e2baa
Delete ContextManagementIT.java
nnegrey Apr 3, 2020
88d4cc0
Create CreateKnowledgeBaseTest
nnegrey Apr 3, 2020
9529431
Create DeleteDocumentTest
nnegrey Apr 3, 2020
dbb58c5
Create DeleteEntityTest
nnegrey Apr 3, 2020
8157b04
Update and rename KnowledgeBaseManagementIT.java to DetectIntentKnowl…
nnegrey Apr 3, 2020
7ed17e0
Update and rename DetectIntentWithAudioAndModelSelectionIT.java to De…
nnegrey Apr 3, 2020
5c01b08
Create GetDocumentTest
nnegrey Apr 3, 2020
84f6873
Create ListDocumentsTest
nnegrey Apr 3, 2020
b27cbf7
Delete SessionEntityTypeManagementIT.java
nnegrey Apr 3, 2020
d732880
Delete EntityManagementIT.java
nnegrey Apr 3, 2020
58c41a0
Update KnowledgeBaseManagement.java
nnegrey Apr 3, 2020
3eca251
Update DocumentManagement.java
nnegrey Apr 3, 2020
21c6ef8
Update DetectIntentWithTextToSpeechResponse.java
nnegrey Apr 3, 2020
485ce50
Update DetectIntentWithSentimentAnalysis.java
nnegrey Apr 3, 2020
3aef9be
Update DetectIntentTexts.java
nnegrey Apr 3, 2020
2c439b1
Update DetectIntentKnowledge.java
nnegrey Apr 3, 2020
527a987
Rename CreateDocumentTest to CreateDocumentTest.java
nnegrey Apr 3, 2020
539ceff
Rename CreateEntityTest to CreateEntityTest.java
nnegrey Apr 3, 2020
c516e9a
Rename CreateKnowledgeBaseTest to CreateKnowledgeBaseTest.java
nnegrey Apr 3, 2020
c8f2664
Rename DeleteDocumentTest to DeleteDocumentTest.java
nnegrey Apr 3, 2020
08b9cd1
Rename DeleteEntityTest to DeleteEntityTest.java
nnegrey Apr 3, 2020
8867e88
Rename ListDocumentsTest to ListDocumentsTest.java
nnegrey Apr 3, 2020
fecc2ed
Rename GetDocumentTest to GetDocumentTest.java
nnegrey Apr 3, 2020
53feaef
Update DeleteDocumentTest.java
nnegrey Apr 3, 2020
d12cee0
Update DeleteDocumentTest.java
nnegrey Apr 3, 2020
01ad5c0
merge master to branch
Strykrol Apr 7, 2020
3acc1bf
Merge branch 'master' into snippetCleanup
nnegrey Apr 7, 2020
693efc4
Merge branch 'master' into snippetCleanup
nnegrey Apr 7, 2020
f6ddb01
Update DeleteDocumentTest.java
nnegrey Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,40 +32,6 @@
* DialogFlow API Context sample.
*/
public class ContextManagement {
// [START dialogflow_list_contexts]

/**
* Lists contexts
*
* @param sessionId Identifier of the DetectIntent session.
* @param projectId Project/Agent Id.
* @return List of Contexts found.
*/
public static List<Context> listContexts(String sessionId, String projectId) throws Exception {
List<Context> contexts = Lists.newArrayList();
// Instantiates a client
try (ContextsClient contextsClient = ContextsClient.create()) {
// Set the session name using the sessionId (UUID) and projectId (my-project-id)
SessionName session = SessionName.of(projectId, sessionId);

// Performs the list contexts request
for (Context context : contextsClient.listContexts(session).iterateAll()) {
System.out.format("Context name: %s\n", context.getName());
System.out.format("Lifespan Count: %d\n", context.getLifespanCount());
System.out.format("Fields:\n");
for (Entry<String, Value> entry : context.getParameters().getFieldsMap().entrySet()) {
if (entry.getValue().hasStructValue()) {
System.out.format("\t%s: %s\n", entry.getKey(), entry.getValue());
}
}

contexts.add(context);
}
}
return contexts;
}
// [END dialogflow_list_contexts]

// [START dialogflow_create_context]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,6 @@
* DialogFlow API Entity sample.
*/
public class EntityManagement {
// [START dialogflow_list_entities]

/**
* List entities
*
* @param projectId Project/agent id.
* @param entityTypeId The id of the entity_type.
* @return List of found entities.
*/
public static List<Entity> listEntities(String projectId, String entityTypeId) throws Exception {
// Instantiates a client
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
// Set the entity type name using the projectID (my-project-id) and entityTypeId (KIND_LIST)
EntityTypeName name = EntityTypeName.of(projectId, entityTypeId);

// Performs the get entity type request
EntityType entityType = entityTypesClient.getEntityType(name);
List<Entity> entities = entityType.getEntitiesList();
for (Entity entity : entities) {
System.out.format("Entity value: %s\n", entity.getValue());
System.out.format("Entity synonyms: %s\n", entity.getSynonymsList().toString());
}
return entities;
}
}
// [END dialogflow_list_entities]

// [START dialogflow_create_entity]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,6 @@
* DialogFlow API EntityType sample.
*/
public class EntityTypeManagement {
// [START dialogflow_list_entity_types]

/**
* List entity types
*
* @param projectId Project/agent id.
* @return The EntityTypes found.
*/
public static List<EntityType> listEntityTypes(String projectId) throws Exception {
List<EntityType> entityTypes = Lists.newArrayList();
// Instantiates a client
try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) {
// Set the project agent name using the projectID (my-project-id)
ProjectAgentName parent = ProjectAgentName.of(projectId);

// Performs the list entity types request
for (EntityType entityType : entityTypesClient.listEntityTypes(parent).iterateAll()) {
System.out.format("Entity type name %s\n", entityType.getName());
System.out.format("Entity type display name: %s\n", entityType.getDisplayName());
System.out.format("Number of entities: %d\n", entityType.getEntitiesCount());

entityTypes.add(entityType);
}
}
return entityTypes;
}
// [END dialogflow_list_entity_types]

// [START dialogflow_create_entity_type]

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,6 @@
* DialogFlow API SessionEntityType sample.
*/
public class SessionEntityTypeManagement {
// [START dialogflow_list_session_entity_types]

/**
* List session entity types
*
* @param projectId Project/Agent Id.
* @param sessionId Identifier of the DetectIntent session.
* @return SessionEntityTypes found.
*/
public static List<SessionEntityType> listSessionEntityTypes(String projectId, String sessionId)
throws Exception {
List<SessionEntityType> sessionEntityTypes = Lists.newArrayList();
// Instantiates a client
try (SessionEntityTypesClient sessionEntityTypesClient = SessionEntityTypesClient.create()) {
// Set the session name using the sessionId (UUID) and projectID (my-project-id)
SessionName session = SessionName.of(projectId, sessionId);

System.out.format("SessionEntityTypes for session %s:\n", session.toString());
// Performs the list session entity types request
for (SessionEntityType sessionEntityType :
sessionEntityTypesClient.listSessionEntityTypes(session).iterateAll()) {
System.out.format("\tSessionEntityType name: %s\n", sessionEntityType.getName());
System.out.format("\tNumber of entities: %d\n", sessionEntityType.getEntitiesCount());

sessionEntityTypes.add(sessionEntityType);
}
}
return sessionEntityTypes;
}
// [END dialogflow_list_session_entity_types]

// [START dialogflow_create_session_entity_type]

/**
Expand Down