From 0e85a0cffbcb8da5c7f0ec77cca0709afb6d5de8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 15:53:39 -0700 Subject: [PATCH] feat: added support for TelephonyTransferCall in Participant ResponseMessage (#880) PiperOrigin-RevId: 399792725 Source-Link: https://github.com/googleapis/googleapis/commit/ee3c7eb3401f8de84348046b71fba7b1ac2215cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/9203bde6e7a4a47aaacb1401e72a24172dc71d22 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTIwM2JkZTZlN2E0YTQ3YWFhY2IxNDAxZTcyYTI0MTcyZGM3MWQyMiJ9 --- .../dialogflow/v2beta1/audio_config.proto | 60 ++-- .../dialogflow/v2beta1/participant.proto | 18 + .../protos/protos.d.ts | 131 ++++++- .../google-cloud-dialogflow/protos/protos.js | 323 ++++++++++++++++-- .../protos/protos.json | 51 ++- .../generated/v2/agents.delete_agent.js | 53 +++ .../generated/v2/agents.export_agent.js | 62 ++++ .../samples/generated/v2/agents.get_agent.js | 53 +++ .../v2/agents.get_validation_result.js | 61 ++++ .../generated/v2/agents.import_agent.js | 63 ++++ .../generated/v2/agents.restore_agent.js | 63 ++++ .../generated/v2/agents.search_agents.js | 64 ++++ .../samples/generated/v2/agents.set_agent.js | 56 +++ .../generated/v2/agents.train_agent.js | 54 +++ .../v2/answer_records.list_answer_records.js | 78 +++++ .../v2/answer_records.update_answer_record.js | 57 ++++ .../generated/v2/contexts.create_context.js | 62 ++++ .../v2/contexts.delete_all_contexts.js | 57 ++++ .../generated/v2/contexts.delete_context.js | 57 ++++ .../generated/v2/contexts.get_context.js | 57 ++++ .../generated/v2/contexts.list_contexts.js | 68 ++++ .../generated/v2/contexts.update_context.js | 56 +++ ...on_profiles.create_conversation_profile.js | 58 ++++ ...on_profiles.delete_conversation_profile.js | 54 +++ ...ation_profiles.get_conversation_profile.js | 54 +++ ...ion_profiles.list_conversation_profiles.js | 66 ++++ ...on_profiles.update_conversation_profile.js | 57 ++++ .../v2/conversations.complete_conversation.js | 54 +++ .../v2/conversations.create_conversation.js | 70 ++++ .../v2/conversations.get_conversation.js | 54 +++ .../v2/conversations.list_conversations.js | 82 +++++ .../v2/conversations.list_messages.js | 75 ++++ .../generated/v2/documents.create_document.js | 60 ++++ .../generated/v2/documents.delete_document.js | 55 +++ .../generated/v2/documents.get_document.js | 54 +++ .../generated/v2/documents.list_documents.js | 65 ++++ .../generated/v2/documents.reload_document.js | 62 ++++ .../generated/v2/documents.update_document.js | 59 ++++ .../v2/entity_types.batch_create_entities.js | 67 ++++ .../v2/entity_types.batch_delete_entities.js | 69 ++++ .../entity_types.batch_delete_entity_types.js | 60 ++++ .../v2/entity_types.batch_update_entities.js | 71 ++++ .../entity_types.batch_update_entity_types.js | 77 +++++ .../v2/entity_types.create_entity_type.js | 66 ++++ .../v2/entity_types.delete_entity_type.js | 53 +++ .../v2/entity_types.get_entity_type.js | 61 ++++ .../v2/entity_types.list_entity_types.js | 72 ++++ .../v2/entity_types.update_entity_type.js | 64 ++++ .../v2/environments.create_environment.js | 65 ++++ .../v2/environments.delete_environment.js | 57 ++++ .../v2/environments.get_environment.js | 57 ++++ .../environments.get_environment_history.js | 68 ++++ .../v2/environments.list_environments.js | 66 ++++ .../v2/environments.update_environment.js | 64 ++++ .../v2/fulfillments.get_fulfillment.js | 53 +++ .../v2/fulfillments.update_fulfillment.js | 58 ++++ .../v2/intents.batch_delete_intents.js | 60 ++++ .../v2/intents.batch_update_intents.js | 80 +++++ .../generated/v2/intents.create_intent.js | 70 ++++ .../generated/v2/intents.delete_intent.js | 54 +++ .../generated/v2/intents.get_intent.js | 65 ++++ .../generated/v2/intents.list_intents.js | 83 +++++ .../generated/v2/intents.update_intent.js | 68 ++++ .../knowledge_bases.create_knowledge_base.js | 58 ++++ .../knowledge_bases.delete_knowledge_base.js | 59 ++++ .../v2/knowledge_bases.get_knowledge_base.js | 54 +++ .../knowledge_bases.list_knowledge_bases.js | 64 ++++ .../knowledge_bases.update_knowledge_base.js | 58 ++++ .../v2/participants.analyze_content.js | 80 +++++ .../v2/participants.create_participant.js | 59 ++++ .../v2/participants.get_participant.js | 54 +++ .../v2/participants.list_participants.js | 65 ++++ .../v2/participants.suggest_articles.js | 67 ++++ .../v2/participants.suggest_faq_answers.js | 67 ++++ .../v2/participants.update_participant.js | 57 ++++ ...entity_types.create_session_entity_type.js | 62 ++++ ...entity_types.delete_session_entity_type.js | 58 ++++ ...on_entity_types.get_session_entity_type.js | 58 ++++ ..._entity_types.list_session_entity_types.js | 70 ++++ ...entity_types.update_session_entity_type.js | 56 +++ .../generated/v2/sessions.detect_intent.js | 99 ++++++ .../v2/sessions.streaming_detect_intent.js | 120 +++++++ .../generated/v2/versions.create_version.js | 60 ++++ .../generated/v2/versions.delete_version.js | 56 +++ .../generated/v2/versions.get_version.js | 56 +++ .../generated/v2/versions.list_versions.js | 66 ++++ .../generated/v2/versions.update_version.js | 61 ++++ .../generated/v2beta1/agents.delete_agent.js | 54 +++ .../generated/v2beta1/agents.export_agent.js | 63 ++++ .../generated/v2beta1/agents.get_agent.js | 54 +++ .../v2beta1/agents.get_validation_result.js | 62 ++++ .../generated/v2beta1/agents.import_agent.js | 64 ++++ .../generated/v2beta1/agents.restore_agent.js | 64 ++++ .../generated/v2beta1/agents.search_agents.js | 65 ++++ .../generated/v2beta1/agents.set_agent.js | 56 +++ .../generated/v2beta1/agents.train_agent.js | 55 +++ .../answer_records.get_answer_record.js | 52 +++ .../answer_records.list_answer_records.js | 67 ++++ .../answer_records.update_answer_record.js | 56 +++ .../v2beta1/contexts.create_context.js | 68 ++++ .../v2beta1/contexts.delete_all_contexts.js | 63 ++++ .../v2beta1/contexts.delete_context.js | 64 ++++ .../generated/v2beta1/contexts.get_context.js | 64 ++++ .../v2beta1/contexts.list_contexts.js | 74 ++++ .../v2beta1/contexts.update_context.js | 56 +++ ...on_profiles.create_conversation_profile.js | 59 ++++ ...on_profiles.delete_conversation_profile.js | 55 +++ ...ation_profiles.get_conversation_profile.js | 55 +++ ...ion_profiles.list_conversation_profiles.js | 67 ++++ ...on_profiles.update_conversation_profile.js | 58 ++++ .../conversations.batch_create_messages.js | 61 ++++ .../conversations.complete_conversation.js | 54 +++ .../conversations.create_conversation.js | 70 ++++ .../v2beta1/conversations.get_conversation.js | 54 +++ .../conversations.list_conversations.js | 82 +++++ .../v2beta1/conversations.list_messages.js | 75 ++++ .../v2beta1/documents.create_document.js | 65 ++++ .../v2beta1/documents.delete_document.js | 55 +++ .../v2beta1/documents.get_document.js | 54 +++ .../v2beta1/documents.import_documents.js | 73 ++++ .../v2beta1/documents.list_documents.js | 83 +++++ .../v2beta1/documents.reload_document.js | 65 ++++ .../v2beta1/documents.update_document.js | 59 ++++ .../entity_types.batch_create_entities.js | 70 ++++ .../entity_types.batch_delete_entities.js | 72 ++++ .../entity_types.batch_delete_entity_types.js | 62 ++++ .../entity_types.batch_update_entities.js | 74 ++++ .../entity_types.batch_update_entity_types.js | 79 +++++ .../entity_types.create_entity_type.js | 68 ++++ .../entity_types.delete_entity_type.js | 56 +++ .../v2beta1/entity_types.get_entity_type.js | 64 ++++ .../v2beta1/entity_types.list_entity_types.js | 74 ++++ .../entity_types.update_entity_type.js | 64 ++++ .../environments.create_environment.js | 65 ++++ .../environments.delete_environment.js | 56 +++ .../v2beta1/environments.get_environment.js | 56 +++ .../environments.get_environment_history.js | 67 ++++ .../v2beta1/environments.list_environments.js | 66 ++++ .../environments.update_environment.js | 64 ++++ .../v2beta1/fulfillments.get_fulfillment.js | 55 +++ .../fulfillments.update_fulfillment.js | 58 ++++ .../v2beta1/intents.batch_delete_intents.js | 62 ++++ .../v2beta1/intents.batch_update_intents.js | 82 +++++ .../v2beta1/intents.create_intent.js | 72 ++++ .../v2beta1/intents.delete_intent.js | 56 +++ .../generated/v2beta1/intents.get_intent.js | 67 ++++ .../generated/v2beta1/intents.list_intents.js | 83 +++++ .../v2beta1/intents.update_intent.js | 68 ++++ .../knowledge_bases.create_knowledge_base.js | 58 ++++ .../knowledge_bases.delete_knowledge_base.js | 59 ++++ .../knowledge_bases.get_knowledge_base.js | 54 +++ .../knowledge_bases.list_knowledge_bases.js | 86 +++++ .../knowledge_bases.update_knowledge_base.js | 58 ++++ .../v2beta1/participants.analyze_content.js | 95 ++++++ .../participants.compile_suggestion.js | 65 ++++ .../participants.create_participant.js | 59 ++++ .../v2beta1/participants.get_participant.js | 54 +++ .../v2beta1/participants.list_participants.js | 65 ++++ .../v2beta1/participants.list_suggestions.js | 73 ++++ .../v2beta1/participants.suggest_articles.js | 67 ++++ .../participants.suggest_faq_answers.js | 67 ++++ .../participants.suggest_smart_replies.js | 73 ++++ .../participants.update_participant.js | 57 ++++ ...entity_types.create_session_entity_type.js | 70 ++++ ...entity_types.delete_session_entity_type.js | 66 ++++ ...on_entity_types.get_session_entity_type.js | 65 ++++ ..._entity_types.list_session_entity_types.js | 78 +++++ ...entity_types.update_session_entity_type.js | 57 ++++ .../v2beta1/sessions.detect_intent.js | 105 ++++++ .../sessions.streaming_detect_intent.js | 127 +++++++ .../v2beta1/versions.create_version.js | 60 ++++ .../v2beta1/versions.delete_version.js | 56 +++ .../generated/v2beta1/versions.get_version.js | 56 +++ .../v2beta1/versions.list_versions.js | 66 ++++ .../v2beta1/versions.update_version.js | 61 ++++ .../src/v2/agents_client.ts | 6 +- .../src/v2/answer_records_client.ts | 6 +- .../src/v2/contexts_client.ts | 6 +- .../src/v2/conversation_profiles_client.ts | 6 +- .../src/v2/conversations_client.ts | 12 +- .../src/v2/documents_client.ts | 6 +- .../src/v2/entity_types_client.ts | 6 +- .../src/v2/environments_client.ts | 12 +- .../src/v2/intents_client.ts | 6 +- .../src/v2/knowledge_bases_client.ts | 6 +- .../src/v2/participants_client.ts | 6 +- .../src/v2/session_entity_types_client.ts | 6 +- .../src/v2/versions_client.ts | 6 +- .../src/v2beta1/agents_client.ts | 6 +- .../src/v2beta1/answer_records_client.ts | 6 +- .../src/v2beta1/contexts_client.ts | 6 +- .../v2beta1/conversation_profiles_client.ts | 6 +- .../src/v2beta1/conversations_client.ts | 12 +- .../src/v2beta1/documents_client.ts | 6 +- .../src/v2beta1/entity_types_client.ts | 6 +- .../src/v2beta1/environments_client.ts | 12 +- .../src/v2beta1/intents_client.ts | 6 +- .../src/v2beta1/knowledge_bases_client.ts | 6 +- .../src/v2beta1/participants_client.ts | 12 +- .../v2beta1/session_entity_types_client.ts | 6 +- .../src/v2beta1/versions_client.ts | 6 +- 201 files changed, 11577 insertions(+), 146 deletions(-) create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js create mode 100644 packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto index f12874b6b6e..11eab2d24c0 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -31,36 +31,6 @@ option java_outer_classname = "AudioConfigProto"; option java_package = "com.google.cloud.dialogflow.v2beta1"; option objc_class_prefix = "DF"; -// Hints for the speech recognizer to help with recognition in a specific -// conversation state. -message SpeechContext { - // Optional. A list of strings containing words and phrases that the speech - // recognizer should recognize with higher likelihood. - // - // This list can be used to: - // - // * improve accuracy for words and phrases you expect the user to say, - // e.g. typical commands for your Dialogflow agent - // * add additional words to the speech recognizer vocabulary - // * ... - // - // See the [Cloud Speech - // documentation](https://cloud.google.com/speech-to-text/quotas) for usage - // limits. - repeated string phrases = 1; - - // Optional. Boost for this context compared to other contexts: - // - // * If the boost is positive, Dialogflow will increase the probability that - // the phrases in this context are recognized over similar sounding phrases. - // * If the boost is unspecified or non-positive, Dialogflow will not apply - // any boost. - // - // Dialogflow recommends that you use boosts in the range (0, 20] and that you - // find a value that fits your use case with binary search. - float boost = 2; -} - // Audio encoding of the audio content sent in the conversational query request. // Refer to the // [Cloud Speech API @@ -110,6 +80,36 @@ enum AudioEncoding { AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; } +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + // Information for a word recognized by the speech recognizer. message SpeechWordInfo { // The word this info is for. diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto index 0078aa1ac79..52a2ee10e37 100644 --- a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -1044,6 +1044,20 @@ message ResponseMessage { } + // Represents the signal that telles the client to transfer the phone call + // connected to the agent to a third-party endpoint. + message TelephonyTransferCall { + // Endpoint to transfer the call to. + oneof endpoint { + // Transfer the call to a phone number + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + string phone_number = 1; + + // Transfer the call to a SIP endpoint. + string sip_uri = 2; + } + } + // Required. The rich response message. oneof message { // Returns a text response. @@ -1058,5 +1072,9 @@ message ResponseMessage { // A signal that indicates the interaction with the Dialogflow agent has // ended. EndInteraction end_interaction = 4; + + // A signal that the client should transfer the phone call connected to + // this agent to a third-party endpoint. + TelephonyTransferCall telephony_transfer_call = 6; } } diff --git a/packages/google-cloud-dialogflow/protos/protos.d.ts b/packages/google-cloud-dialogflow/protos/protos.d.ts index 01f0e798329..8abec25d73a 100644 --- a/packages/google-cloud-dialogflow/protos/protos.d.ts +++ b/packages/google-cloud-dialogflow/protos/protos.d.ts @@ -27325,6 +27325,18 @@ export namespace google { } } + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + /** Properties of a SpeechContext. */ interface ISpeechContext { @@ -27421,18 +27433,6 @@ export namespace google { public toJSON(): { [k: string]: any }; } - /** AudioEncoding enum. */ - enum AudioEncoding { - AUDIO_ENCODING_UNSPECIFIED = 0, - AUDIO_ENCODING_LINEAR_16 = 1, - AUDIO_ENCODING_FLAC = 2, - AUDIO_ENCODING_MULAW = 3, - AUDIO_ENCODING_AMR = 4, - AUDIO_ENCODING_AMR_WB = 5, - AUDIO_ENCODING_OGG_OPUS = 6, - AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 - } - /** Properties of a SpeechWordInfo. */ interface ISpeechWordInfo { @@ -33753,6 +33753,9 @@ export namespace google { /** ResponseMessage endInteraction */ endInteraction?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null); + + /** ResponseMessage telephonyTransferCall */ + telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null); } /** Represents a ResponseMessage. */ @@ -33776,8 +33779,11 @@ export namespace google { /** ResponseMessage endInteraction. */ public endInteraction?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null); + /** ResponseMessage telephonyTransferCall. */ + public telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null); + /** ResponseMessage message. */ - public message?: ("text"|"payload"|"liveAgentHandoff"|"endInteraction"); + public message?: ("text"|"payload"|"liveAgentHandoff"|"endInteraction"|"telephonyTransferCall"); /** * Creates a new ResponseMessage instance using the specified properties. @@ -34115,6 +34121,105 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** Properties of a TelephonyTransferCall. */ + interface ITelephonyTransferCall { + + /** TelephonyTransferCall phoneNumber */ + phoneNumber?: (string|null); + + /** TelephonyTransferCall sipUri */ + sipUri?: (string|null); + } + + /** Represents a TelephonyTransferCall. */ + class TelephonyTransferCall implements ITelephonyTransferCall { + + /** + * Constructs a new TelephonyTransferCall. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall); + + /** TelephonyTransferCall phoneNumber. */ + public phoneNumber?: (string|null); + + /** TelephonyTransferCall sipUri. */ + public sipUri?: (string|null); + + /** TelephonyTransferCall endpoint. */ + public endpoint?: ("phoneNumber"|"sipUri"); + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyTransferCall instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Verifies a TelephonyTransferCall message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyTransferCall + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @param message TelephonyTransferCall + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } } /** Properties of a GcsSources. */ diff --git a/packages/google-cloud-dialogflow/protos/protos.js b/packages/google-cloud-dialogflow/protos/protos.js index 6a48f627679..8606600ed96 100644 --- a/packages/google-cloud-dialogflow/protos/protos.js +++ b/packages/google-cloud-dialogflow/protos/protos.js @@ -64665,6 +64665,32 @@ return EnvironmentHistory; })(); + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2beta1.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v2beta1.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + v2beta1.SpeechContext = (function() { /** @@ -64891,32 +64917,6 @@ return SpeechContext; })(); - /** - * AudioEncoding enum. - * @name google.cloud.dialogflow.v2beta1.AudioEncoding - * @enum {number} - * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value - * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value - * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value - * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value - * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value - * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value - * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value - * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value - */ - v2beta1.AudioEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; - values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; - values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; - values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; - values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; - values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; - values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; - return values; - })(); - v2beta1.SpeechWordInfo = (function() { /** @@ -80550,6 +80550,7 @@ * @property {google.protobuf.IStruct|null} [payload] ResponseMessage payload * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff|null} [liveAgentHandoff] ResponseMessage liveAgentHandoff * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null} [endInteraction] ResponseMessage endInteraction + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null} [telephonyTransferCall] ResponseMessage telephonyTransferCall */ /** @@ -80599,17 +80600,25 @@ */ ResponseMessage.prototype.endInteraction = null; + /** + * ResponseMessage telephonyTransferCall. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null|undefined} telephonyTransferCall + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.telephonyTransferCall = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * ResponseMessage message. - * @member {"text"|"payload"|"liveAgentHandoff"|"endInteraction"|undefined} message + * @member {"text"|"payload"|"liveAgentHandoff"|"endInteraction"|"telephonyTransferCall"|undefined} message * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage * @instance */ Object.defineProperty(ResponseMessage.prototype, "message", { - get: $util.oneOfGetter($oneOfFields = ["text", "payload", "liveAgentHandoff", "endInteraction"]), + get: $util.oneOfGetter($oneOfFields = ["text", "payload", "liveAgentHandoff", "endInteraction", "telephonyTransferCall"]), set: $util.oneOfSetter($oneOfFields) }); @@ -80645,6 +80654,8 @@ $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.encode(message.liveAgentHandoff, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.encode(message.endInteraction, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.telephonyTransferCall != null && Object.hasOwnProperty.call(message, "telephonyTransferCall")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.encode(message.telephonyTransferCall, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -80691,6 +80702,9 @@ case 4: message.endInteraction = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.decode(reader, reader.uint32()); break; + case 6: + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -80765,6 +80779,16 @@ return "endInteraction." + error; } } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify(message.telephonyTransferCall); + if (error) + return "telephonyTransferCall." + error; + } + } return null; }; @@ -80800,6 +80824,11 @@ throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.endInteraction: object expected"); message.endInteraction = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.fromObject(object.endInteraction); } + if (object.telephonyTransferCall != null) { + if (typeof object.telephonyTransferCall !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.telephonyTransferCall: object expected"); + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.fromObject(object.telephonyTransferCall); + } return message; }; @@ -80836,6 +80865,11 @@ if (options.oneofs) object.message = "endInteraction"; } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + object.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.toObject(message.telephonyTransferCall, options); + if (options.oneofs) + object.message = "telephonyTransferCall"; + } return object; }; @@ -81405,6 +81439,239 @@ return EndInteraction; })(); + ResponseMessage.TelephonyTransferCall = (function() { + + /** + * Properties of a TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface ITelephonyTransferCall + * @property {string|null} [phoneNumber] TelephonyTransferCall phoneNumber + * @property {string|null} [sipUri] TelephonyTransferCall sipUri + */ + + /** + * Constructs a new TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents a TelephonyTransferCall. + * @implements ITelephonyTransferCall + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall=} [properties] Properties to set + */ + function TelephonyTransferCall(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyTransferCall phoneNumber. + * @member {string|null|undefined} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + TelephonyTransferCall.prototype.phoneNumber = null; + + /** + * TelephonyTransferCall sipUri. + * @member {string|null|undefined} sipUri + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + TelephonyTransferCall.prototype.sipUri = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TelephonyTransferCall endpoint. + * @member {"phoneNumber"|"sipUri"|undefined} endpoint + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + Object.defineProperty(TelephonyTransferCall.prototype, "endpoint", { + get: $util.oneOfGetter($oneOfFields = ["phoneNumber", "sipUri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall instance + */ + TelephonyTransferCall.create = function create(properties) { + return new TelephonyTransferCall(properties); + }; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phoneNumber); + if (message.sipUri != null && Object.hasOwnProperty.call(message, "sipUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sipUri); + return writer; + }; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.phoneNumber = reader.string(); + break; + case 2: + message.sipUri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyTransferCall message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyTransferCall.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + properties.endpoint = 1; + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + } + if (message.sipUri != null && message.hasOwnProperty("sipUri")) { + if (properties.endpoint === 1) + return "endpoint: multiple values"; + properties.endpoint = 1; + if (!$util.isString(message.sipUri)) + return "sipUri: string expected"; + } + return null; + }; + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + */ + TelephonyTransferCall.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + if (object.sipUri != null) + message.sipUri = String(object.sipUri); + return message; + }; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} message TelephonyTransferCall + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyTransferCall.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + object.phoneNumber = message.phoneNumber; + if (options.oneofs) + object.endpoint = "phoneNumber"; + } + if (message.sipUri != null && message.hasOwnProperty("sipUri")) { + object.sipUri = message.sipUri; + if (options.oneofs) + object.endpoint = "sipUri"; + } + return object; + }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + * @returns {Object.} JSON object + */ + TelephonyTransferCall.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TelephonyTransferCall; + })(); + return ResponseMessage; })(); diff --git a/packages/google-cloud-dialogflow/protos/protos.json b/packages/google-cloud-dialogflow/protos/protos.json index 120fb2c3e0e..f96719cc93c 100644 --- a/packages/google-cloud-dialogflow/protos/protos.json +++ b/packages/google-cloud-dialogflow/protos/protos.json @@ -8665,6 +8665,18 @@ } } }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, "SpeechContext": { "fields": { "phrases": { @@ -8678,18 +8690,6 @@ } } }, - "AudioEncoding": { - "values": { - "AUDIO_ENCODING_UNSPECIFIED": 0, - "AUDIO_ENCODING_LINEAR_16": 1, - "AUDIO_ENCODING_FLAC": 2, - "AUDIO_ENCODING_MULAW": 3, - "AUDIO_ENCODING_AMR": 4, - "AUDIO_ENCODING_AMR_WB": 5, - "AUDIO_ENCODING_OGG_OPUS": 6, - "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 - } - }, "SpeechWordInfo": { "fields": { "word": { @@ -10448,7 +10448,8 @@ "text", "payload", "liveAgentHandoff", - "endInteraction" + "endInteraction", + "telephonyTransferCall" ] } }, @@ -10468,6 +10469,10 @@ "endInteraction": { "type": "EndInteraction", "id": 4 + }, + "telephonyTransferCall": { + "type": "TelephonyTransferCall", + "id": 6 } }, "nested": { @@ -10490,6 +10495,26 @@ }, "EndInteraction": { "fields": {} + }, + "TelephonyTransferCall": { + "oneofs": { + "endpoint": { + "oneof": [ + "phoneNumber", + "sipUri" + ] + } + }, + "fields": { + "phoneNumber": { + "type": "string", + "id": 1 + }, + "sipUri": { + "type": "string", + "id": 2 + } + } } } }, diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js new file mode 100644 index 00000000000..eba49c9cccb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_DeleteAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to delete is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function deleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + deleteAgent(); + // [END dialogflow_v2_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js new file mode 100644 index 00000000000..b3daf997e0b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, agentUri) { + // [START dialogflow_v2_generated_Agents_ExportAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to export is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function exportAgent() { + // Construct request + const request = { + parent, + agentUri, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + exportAgent(); + // [END dialogflow_v2_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js new file mode 100644 index 00000000000..07fceb7e298 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_GetAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to fetch is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function getAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + getAgent(); + // [END dialogflow_v2_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js new file mode 100644 index 00000000000..60c0b7ffaf2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_GetValidationResult_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function getValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + getValidationResult(); + // [END dialogflow_v2_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js new file mode 100644 index 00000000000..fd6b44d947b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js @@ -0,0 +1,63 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_ImportAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to import is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function importAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + importAgent(); + // [END dialogflow_v2_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js new file mode 100644 index 00000000000..62d6f5c1f2b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js @@ -0,0 +1,63 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_RestoreAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to restore is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function restoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + restoreAgent(); + // [END dialogflow_v2_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js new file mode 100644 index 00000000000..cc35d530fe3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_SearchAgents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list agents from. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function searchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + searchAgents(); + // [END dialogflow_v2_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js new file mode 100644 index 00000000000..1b868989019 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(agent) { + // [START dialogflow_v2_generated_Agents_SetAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to update. + */ + // const agent = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function setAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + setAgent(); + // [END dialogflow_v2_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js new file mode 100644 index 00000000000..633ce3aca6c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Agents_TrainAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to train is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function trainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + trainAgent(); + // [END dialogflow_v2_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js new file mode 100644 index 00000000000..1bb997b293f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js @@ -0,0 +1,78 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, filter) { + // [START dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. Filters to restrict results to specific answer records. + * Filter on answer record type. Currently predicates on `type` is supported, + * valid values are `ARTICLE_ANSWER`, `FAQ_ANSWER`. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + */ + // const pageSize = 1234 + /** + * Optional. The + * [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token] + * value returned from a previous list request used to continue listing on + * the next page. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function listAnswerRecords() { + // Construct request + const request = { + parent, + filter, + }; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAnswerRecords(); + // [END dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js new file mode 100644 index 00000000000..74ce76e00ce --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(answerRecord, updateMask) { + // [START dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Answer record to update. + */ + // const answerRecord = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function updateAnswerRecord() { + // Construct request + const request = { + answerRecord, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + updateAnswerRecord(); + // [END dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js new file mode 100644 index 00000000000..1d0563ef20e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, context) { + // [START dialogflow_v2_generated_Contexts_CreateContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to create a context for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = '' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function createContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + createContext(); + // [END dialogflow_v2_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..aeb652023cf --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Contexts_DeleteAllContexts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session to delete all contexts from. Format: + * `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function deleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + deleteAllContexts(); + // [END dialogflow_v2_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js new file mode 100644 index 00000000000..97befd50a11 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Contexts_DeleteContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the context to delete. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function deleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + deleteContext(); + // [END dialogflow_v2_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js new file mode 100644 index 00000000000..62f9e8f015b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Contexts_GetContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the context. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function getContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + getContext(); + // [END dialogflow_v2_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js new file mode 100644 index 00000000000..85eb7123c53 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Contexts_ListContexts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function listContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listContexts(); + // [END dialogflow_v2_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js new file mode 100644 index 00000000000..d52c2f8bbd7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(context) { + // [START dialogflow_v2_generated_Contexts_UpdateContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The context to update. + */ + // const context = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function updateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + updateContext(); + // [END dialogflow_v2_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..f97b1708c78 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, conversationProfile) { + // [START dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = '' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function createConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + createConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..65db7c8f8bb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function deleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + deleteConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..e112e35e1a8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function getConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + getConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..8ad5b4249a9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function listConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listConversationProfiles(); + // [END dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..85bce09fd8f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(conversationProfile, updateMask) { + // [START dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation profile to update. + */ + // const conversationProfile = '' + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function updateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + updateConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js new file mode 100644 index 00000000000..f84f76412bb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Conversations_CompleteConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function completeConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + completeConversation(); + // [END dialogflow_v2_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js new file mode 100644 index 00000000000..0e0ee8c8a85 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, conversation) { + // [START dialogflow_v2_generated_Conversations_CreateConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = '' + /** + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * The conversation ID must be compliant with the regression fomula + * "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function createConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + createConversation(); + // [END dialogflow_v2_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js new file mode 100644 index 00000000000..3c1075007e4 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Conversations_GetConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function getConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + getConversation(); + // [END dialogflow_v2_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js new file mode 100644 index 00000000000..ca3c05e7f6e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Conversations_ListConversations_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * `lifecycle_state = "COMPLETED"` + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function listConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listConversations(); + // [END dialogflow_v2_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js new file mode 100644 index 00000000000..42e73e8a99f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js @@ -0,0 +1,75 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Conversations_ListMessages_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function listMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listMessages(); + // [END dialogflow_v2_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js new file mode 100644 index 00000000000..299c1267d65 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, document) { + // [START dialogflow_v2_generated_Documents_CreateDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = '' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function createDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + createDocument(); + // [END dialogflow_v2_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js new file mode 100644 index 00000000000..251cc2c9b72 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_DeleteDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function deleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + deleteDocument(); + // [END dialogflow_v2_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js new file mode 100644 index 00000000000..8e616221985 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_GetDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function getDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + getDocument(); + // [END dialogflow_v2_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js new file mode 100644 index 00000000000..c67a9ad8aec --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Documents_ListDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function listDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listDocuments(); + // [END dialogflow_v2_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js new file mode 100644 index 00000000000..07dcaab6381 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Documents_ReloadDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * Optional. The path of gcs source file for reloading document content. For now, + * only gcs uri is supported. + * For documents stored in Google Cloud Storage, these URIs must have + * the form `gs:///`. + */ + // const contentUri = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function reloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + reloadDocument(); + // [END dialogflow_v2_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js new file mode 100644 index 00000000000..c7cf16cb2a8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(document) { + // [START dialogflow_v2_generated_Documents_UpdateDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The document to update. + */ + // const document = '' + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function updateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + updateDocument(); + // [END dialogflow_v2_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..764aa4fdf99 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to create entities in. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchCreateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..67f65fe1a7a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js @@ -0,0 +1,69 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityValues) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete entries for. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + */ + // const entityValues = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..6bd8fedddfd --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityTypeNames) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..e9cadb2a1fb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js @@ -0,0 +1,71 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to update or create entities in. + * Format: `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..b6433d71a1a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js @@ -0,0 +1,77 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create entity types in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js new file mode 100644 index 00000000000..ace0b0cbe18 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityType) { + // [START dialogflow_v2_generated_EntityTypes_CreateEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a entity type for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const entityType = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function createEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + createEntityType(); + // [END dialogflow_v2_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..9916c069c17 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function deleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + deleteEntityType(); + // [END dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js new file mode 100644 index 00000000000..00aa5d6f3b1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_EntityTypes_GetEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function getEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + getEntityType(); + // [END dialogflow_v2_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js new file mode 100644 index 00000000000..5643c5f3276 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js @@ -0,0 +1,72 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function listEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js new file mode 100644 index 00000000000..728e35bd726 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(entityType) { + // [START dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The entity type to update. + */ + // const entityType = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function updateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + updateEntityType(); + // [END dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js new file mode 100644 index 00000000000..e72bc7823bd --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, environment, environmentId) { + // [START dialogflow_v2_generated_Environments_CreateEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = '' + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function createEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + createEnvironment(); + // [END dialogflow_v2_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js new file mode 100644 index 00000000000..d641c537115 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Environments_DeleteEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function deleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + deleteEnvironment(); + // [END dialogflow_v2_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js new file mode 100644 index 00000000000..d7574bb14b0 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Environments_GetEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function getEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + getEnvironment(); + // [END dialogflow_v2_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js new file mode 100644 index 00000000000..c1d5dcd1d9a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function getEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + getEnvironmentHistory(); + // [END dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js new file mode 100644 index 00000000000..4993af6c4d8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Environments_ListEnvironments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function listEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listEnvironments(); + // [END dialogflow_v2_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js new file mode 100644 index 00000000000..ee20103dd85 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(environment, updateMask) { + // [START dialogflow_v2_generated_Environments_UpdateEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The environment to update. + */ + // const environment = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. This field is used to prevent accidental overwrite of the default + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the default environment (environment ID = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function updateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + updateEnvironment(); + // [END dialogflow_v2_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..ce7e9fb339d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js @@ -0,0 +1,53 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Fulfillments_GetFulfillment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the fulfillment. + * Format: `projects//agent/fulfillment`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function getFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + getFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..3ac1213a036 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(fulfillment, updateMask) { + // [START dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The fulfillment to update. + */ + // const fulfillment = '' + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function updateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + updateFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js new file mode 100644 index 00000000000..8188369216c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, intents) { + // [START dialogflow_v2_generated_Intents_BatchDeleteIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function batchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteIntents(); + // [END dialogflow_v2_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js new file mode 100644 index 00000000000..53b5ed5d2ff --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js @@ -0,0 +1,80 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Intents_BatchUpdateIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create intents in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function batchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateIntents(); + // [END dialogflow_v2_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js new file mode 100644 index 00000000000..17cfc2ccb72 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, intent) { + // [START dialogflow_v2_generated_Intents_CreateIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a intent for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const intent = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function createIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + createIntent(); + // [END dialogflow_v2_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js new file mode 100644 index 00000000000..dcbc428732a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Intents_DeleteIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function deleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + deleteIntent(); + // [END dialogflow_v2_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js new file mode 100644 index 00000000000..cf3a45c43a7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Intents_GetIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function getIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + getIntent(); + // [END dialogflow_v2_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js new file mode 100644 index 00000000000..9de1ab9f828 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Intents_ListIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function listIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listIntents(); + // [END dialogflow_v2_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js new file mode 100644 index 00000000000..6ffaae383ea --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(intent) { + // [START dialogflow_v2_generated_Intents_UpdateIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The intent to update. + */ + // const intent = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function updateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + updateIntent(); + // [END dialogflow_v2_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..008cc3d364e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = '' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function createKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + createKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..0cc40c59c8e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function deleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + deleteKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..e3fafe26139 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function getKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + getKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..f6bbbb5bc62 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function listKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listKnowledgeBases(); + // [END dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..5929ab08cf6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to update. + */ + // const knowledgeBase = '' + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function updateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + updateKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js new file mode 100644 index 00000000000..d94b4ea199e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js @@ -0,0 +1,80 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(participant) { + // [START dialogflow_v2_generated_Participants_AnalyzeContent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = '' + /** + * An input event to send to Dialogflow. + */ + // const eventInput = '' + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + */ + // const replyAudioConfig = '' + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = '' + /** + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function analyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + analyzeContent(); + // [END dialogflow_v2_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js new file mode 100644 index 00000000000..46d152a9cec --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, participant) { + // [START dialogflow_v2_generated_Participants_CreateParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = '' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function createParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + createParticipant(); + // [END dialogflow_v2_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js new file mode 100644 index 00000000000..9a868a188f5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Participants_GetParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function getParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + getParticipant(); + // [END dialogflow_v2_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js new file mode 100644 index 00000000000..9763ed22084 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_ListParticipants_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function listParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listParticipants(); + // [END dialogflow_v2_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js new file mode 100644 index 00000000000..ce418812155 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_SuggestArticles_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Max number of messages prior to and including + * [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context + * when compiling the suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function suggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + suggestArticles(); + // [END dialogflow_v2_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..4620edf33c3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function suggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + suggestFaqAnswers(); + // [END dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js new file mode 100644 index 00000000000..4a356e691af --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(participant, updateMask) { + // [START dialogflow_v2_generated_Participants_UpdateParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The participant to update. + */ + // const participant = '' + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function updateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + updateParticipant(); + // [END dialogflow_v2_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..075c79407be --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to create a session entity type for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = '' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function createSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + createSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..8a8c5821e14 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function deleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + deleteSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..5d97d84533d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session entity type. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function getSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + getSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..d84930ae2c7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function listSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listSessionEntityTypes(); + // [END dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..9b116d4c838 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session entity type to update. + */ + // const sessionEntityType = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function updateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + updateSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js new file mode 100644 index 00000000000..a22ccae83b7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js @@ -0,0 +1,99 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_DetectIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session this query is sent to. Format: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment (`Environment ID` might be referred to as + * environment name at some places). If `User ID` is not specified, we are + * using "-". It's up to the API caller to choose an appropriate `Session ID` + * and `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). The length of the `Session ID` and + * `User ID` must not exceed 36 characters. + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = '' + /** + * Required. The input specification. It can be set to: + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = '' + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = '' + /** + * Mask for [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = '' + /** + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function detectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + detectIntent(); + // [END dialogflow_v2_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..8933abec7fd --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js @@ -0,0 +1,120 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session the query is sent to. + * Format of the session name: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment. If `User ID` is not specified, we are using + * "-". It's up to the API caller to choose an appropriate `Session ID` and + * `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). The length of the `Session ID` and + * `User ID` must not exceed 36 characters. + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = '' + /** + * Required. The input specification. It can be set to: + * 1. an audio config which instructs the speech recognizer how to process + * the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = '' + /** + * Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] instead. + * If `false` (default), recognition does not cease until + * the client closes the stream. If `true`, the recognizer will detect a + * single spoken utterance in input audio. Recognition ceases when it detects + * the audio's voice has stopped or paused. In this case, once a detected + * intent is received, the client should close the stream and start a new + * request with a new stream as needed. + * This setting is ignored when `query_input` is a piece of text or an event. + */ + // const singleUtterance = true + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = '' + /** + * Mask for [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = '' + /** + * The input audio content to be recognized. Must be sent if + * `query_input` was set to a streaming input audio config. The complete audio + * over all streaming messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function streamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', response => { + console.log(response); + }); + stream.on('error', err => { + throw err; + }); + stream.on('end', () => { + /* API call completed */ + }); + stream.write(request); + stream.end(); + } + + streamingDetectIntent(); + // [END dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js new file mode 100644 index 00000000000..be92d55aa4c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, version) { + // [START dialogflow_v2_generated_Versions_CreateVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = '' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function createVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + createVersion(); + // [END dialogflow_v2_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js new file mode 100644 index 00000000000..1d6f0c6a080 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Versions_DeleteVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function deleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + deleteVersion(); + // [END dialogflow_v2_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js new file mode 100644 index 00000000000..fb294cd6f67 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2_generated_Versions_GetVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function getVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + getVersion(); + // [END dialogflow_v2_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js new file mode 100644 index 00000000000..f459917dda9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2_generated_Versions_ListVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function listVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listVersions(); + // [END dialogflow_v2_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js new file mode 100644 index 00000000000..18d11ac89e1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(version, updateMask) { + // [START dialogflow_v2_generated_Versions_UpdateVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function updateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + updateVersion(); + // [END dialogflow_v2_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js new file mode 100644 index 00000000000..99bf4a318fe --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_DeleteAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to delete is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function deleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + deleteAgent(); + // [END dialogflow_v2beta1_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js new file mode 100644 index 00000000000..a8d65906353 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js @@ -0,0 +1,63 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_ExportAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to export is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The + * [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function exportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + exportAgent(); + // [END dialogflow_v2beta1_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js new file mode 100644 index 00000000000..5b9d737bbdd --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_GetAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to fetch is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function getAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + getAgent(); + // [END dialogflow_v2beta1_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js new file mode 100644 index 00000000000..d63e308d9d6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_GetValidationResult_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function getValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + getValidationResult(); + // [END dialogflow_v2beta1_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js new file mode 100644 index 00000000000..e103013e97b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_ImportAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to import is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function importAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + importAgent(); + // [END dialogflow_v2beta1_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js new file mode 100644 index 00000000000..2aece129733 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_RestoreAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to restore is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function restoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + restoreAgent(); + // [END dialogflow_v2beta1_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js new file mode 100644 index 00000000000..2aaa602a96c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_SearchAgents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function searchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + searchAgents(); + // [END dialogflow_v2beta1_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js new file mode 100644 index 00000000000..0d652315e52 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(agent) { + // [START dialogflow_v2beta1_generated_Agents_SetAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to update. + */ + // const agent = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function setAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + setAgent(); + // [END dialogflow_v2beta1_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js new file mode 100644 index 00000000000..cb3cbb7d054 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Agents_TrainAgent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project that the agent to train is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function trainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + trainAgent(); + // [END dialogflow_v2beta1_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js new file mode 100644 index 00000000000..bf4f628a8bc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js @@ -0,0 +1,52 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main() { + // [START dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the answer record to retrieve. + * Format: `projects//locations//answerRecords/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function getAnswerRecord() { + // Construct request + const request = {}; + + // Run request + const response = await dialogflowClient.getAnswerRecord(request); + console.log(response); + } + + getAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js new file mode 100644 index 00000000000..1e23d6feb90 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main() { + // [START dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + */ + // const pageSize = 1234 + /** + * Optional. The + * [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token] + * value returned from a previous list request used to continue listing on + * the next page. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function listAnswerRecords() { + // Construct request + const request = {}; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listAnswerRecords(); + // [END dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js new file mode 100644 index 00000000000..1bc87c0fe2f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(answerRecord) { + // [START dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Answer record to update. + */ + // const answerRecord = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function updateAnswerRecord() { + // Construct request + const request = { + answerRecord, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + updateAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js new file mode 100644 index 00000000000..ba295b92351 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, context) { + // [START dialogflow_v2beta1_generated_Contexts_CreateContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to create a context for. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = '' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function createContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + createContext(); + // [END dialogflow_v2beta1_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..4101c1daddf --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js @@ -0,0 +1,63 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session to delete all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified we assume default 'draft' environment. If + * `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function deleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + deleteAllContexts(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js new file mode 100644 index 00000000000..064baa0a7c7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Contexts_DeleteContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the context to delete. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function deleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + deleteContext(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js new file mode 100644 index 00000000000..8a9f74655ce --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Contexts_GetContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the context. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function getContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + getContext(); + // [END dialogflow_v2beta1_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js new file mode 100644 index 00000000000..f81fc04504b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js @@ -0,0 +1,74 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Contexts_ListContexts_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function listContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listContexts(); + // [END dialogflow_v2beta1_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js new file mode 100644 index 00000000000..ab272d0c397 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(context) { + // [START dialogflow_v2beta1_generated_Contexts_UpdateContext_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The context to update. + */ + // const context = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function updateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + updateContext(); + // [END dialogflow_v2beta1_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..3fba222bfc1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, conversationProfile) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = '' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function createConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + createConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..bead81700b6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function deleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + deleteConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..50ba5ecdec6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function getConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + getConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..5cf26e1ee9d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function listConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listConversationProfiles(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..00de3dc5223 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(conversationProfile, updateMask) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation profile to update. + */ + // const conversationProfile = '' + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function updateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + updateConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js new file mode 100644 index 00000000000..a70bb19b0e7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, requests) { + // [START dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to create message. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. A maximum of 1000 Messages can be created in a batch. + * [CreateMessageRequest.message.send_time][] is required. All created + * messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time]. + */ + // const requests = 1234 + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function batchCreateMessages() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const response = await dialogflowClient.batchCreateMessages(request); + console.log(response); + } + + batchCreateMessages(); + // [END dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js new file mode 100644 index 00000000000..ae04e94d30c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function completeConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + completeConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js new file mode 100644 index 00000000000..9c8a81b74f3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, conversation) { + // [START dialogflow_v2beta1_generated_Conversations_CreateConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = '' + /** + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * The conversation ID must be compliant with the regression fomula + * "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function createConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + createConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js new file mode 100644 index 00000000000..27e47679e42 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Conversations_GetConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function getConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + getConversation(); + // [END dialogflow_v2beta1_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js new file mode 100644 index 00000000000..0aac35e13b8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Conversations_ListConversations_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * `lifecycle_state = "COMPLETED"` + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function listConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listConversations(); + // [END dialogflow_v2beta1_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js new file mode 100644 index 00000000000..707ca4666e4 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js @@ -0,0 +1,75 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Conversations_ListMessages_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function listMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listMessages(); + // [END dialogflow_v2beta1_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js new file mode 100644 index 00000000000..8b50192c9ce --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, document) { + // [START dialogflow_v2beta1_generated_Documents_CreateDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = '' + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function createDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + createDocument(); + // [END dialogflow_v2beta1_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js new file mode 100644 index 00000000000..64abf22f899 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_DeleteDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function deleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + deleteDocument(); + // [END dialogflow_v2beta1_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js new file mode 100644 index 00000000000..9fe147690d1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_GetDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function getDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + getDocument(); + // [END dialogflow_v2beta1_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js new file mode 100644 index 00000000000..f344e3c4dbc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js @@ -0,0 +1,73 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, documentTemplate) { + // [START dialogflow_v2beta1_generated_Documents_ImportDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + */ + // const gcsSource = '' + /** + * Required. Document template used for importing all the documents. + */ + // const documentTemplate = '' + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function importDocuments() { + // Construct request + const request = { + parent, + documentTemplate, + }; + + // Run request + const [operation] = await dialogflowClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + importDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js new file mode 100644 index 00000000000..805d44e2821 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Documents_ListDocuments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function listDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js new file mode 100644 index 00000000000..0b58bf4e7de --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Documents_ReloadDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * The path for a Cloud Storage source file for reloading document content. + * If not provided, the Document's existing source will be reloaded. + */ + // const gcsSource = '' + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function reloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + reloadDocument(); + // [END dialogflow_v2beta1_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js new file mode 100644 index 00000000000..fc5aec6e841 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(document) { + // [START dialogflow_v2beta1_generated_Documents_UpdateDocument_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The document to update. + */ + // const document = '' + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function updateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + updateDocument(); + // [END dialogflow_v2beta1_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..6f421960be8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchCreateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..b9152b672e2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js @@ -0,0 +1,72 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityValues) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete entries for. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + */ + // const entityValues = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..6d7c721be1d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityTypeNames) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent`, + * - `projects//locations//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..7c98966e496 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js @@ -0,0 +1,74 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to update or create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..b053bf0324c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js @@ -0,0 +1,79 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create entity types in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function batchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js new file mode 100644 index 00000000000..c1de9ddc995 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a entity type for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const entityType = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function createEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + createEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..4f93afdfbe3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function deleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + deleteEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js new file mode 100644 index 00000000000..37a910908c3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function getEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + getEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js new file mode 100644 index 00000000000..b0bc1cfca5c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js @@ -0,0 +1,74 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function listEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js new file mode 100644 index 00000000000..df8e735e082 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The entity type to update. + */ + // const entityType = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function updateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + updateEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js new file mode 100644 index 00000000000..ba49f0b2e7d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, environment, environmentId) { + // [START dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = '' + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function createEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + createEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js new file mode 100644 index 00000000000..72e91733e86 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function deleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + deleteEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js new file mode 100644 index 00000000000..70ab6b2eddb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Environments_GetEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function getEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + getEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js new file mode 100644 index 00000000000..16a1061c74e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function getEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + getEnvironmentHistory(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js new file mode 100644 index 00000000000..6c0af68dafe --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Environments_ListEnvironments_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function listEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listEnvironments(); + // [END dialogflow_v2beta1_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js new file mode 100644 index 00000000000..b1e5e4585f5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(environment, updateMask) { + // [START dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The environment to update. + */ + // const environment = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. This field is used to prevent accidental overwrite of the draft + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the draft environment (environment ID = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function updateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + updateEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..0e9f5783d4a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js @@ -0,0 +1,55 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the fulfillment. + * Supported formats: + * - `projects//agent/fulfillment` + * - `projects//locations//agent/fulfillment` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function getFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + getFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..4d9394194eb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(fulfillment, updateMask) { + // [START dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The fulfillment to update. + */ + // const fulfillment = '' + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function updateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + updateFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js new file mode 100644 index 00000000000..f421cd7a8f4 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js @@ -0,0 +1,62 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, intents) { + // [START dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function batchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchDeleteIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js new file mode 100644 index 00000000000..954f927a4f0 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js @@ -0,0 +1,82 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the agent to update or create intents in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function batchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + batchUpdateIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js new file mode 100644 index 00000000000..4c685df32d9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js @@ -0,0 +1,72 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, intent) { + // [START dialogflow_v2beta1_generated_Intents_CreateIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a intent for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const intent = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function createIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + createIntent(); + // [END dialogflow_v2beta1_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js new file mode 100644 index 00000000000..8c13437d783 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Intents_DeleteIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Supported formats: + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function deleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + deleteIntent(); + // [END dialogflow_v2beta1_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js new file mode 100644 index 00000000000..de18d612635 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Intents_GetIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the intent. + * Supported formats: + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function getIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + getIntent(); + // [END dialogflow_v2beta1_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js new file mode 100644 index 00000000000..623c395a488 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js @@ -0,0 +1,83 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Intents_ListIntents_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function listIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listIntents(); + // [END dialogflow_v2beta1_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js new file mode 100644 index 00000000000..989524e851f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js @@ -0,0 +1,68 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(intent) { + // [START dialogflow_v2beta1_generated_Intents_UpdateIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The intent to update. + */ + // const intent = '' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = '' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function updateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + updateIntent(); + // [END dialogflow_v2beta1_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..4a3a79cab4b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = '' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function createKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + createKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..3bd604aed87 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function deleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + deleteKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..de08c5d36f1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function getKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + getKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..1d250f303a3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,86 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function listKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listKnowledgeBases(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..612286eb264 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,58 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The knowledge base to update. + */ + // const knowledgeBase = '' + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function updateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + updateKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js new file mode 100644 index 00000000000..230e78835c1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js @@ -0,0 +1,95 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(participant) { + // [START dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = '' + /** + * An input event to send to Dialogflow. + */ + // const eventInput = '' + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + */ + // const replyAudioConfig = '' + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = '' + /** + * Optional. The send time of the message from end user or human agent's + * perspective. It is used for identifying the same message under one + * participant. + * Given two messages under the same participant: + * - If send time are different regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * two distinct messages sent by the participant. + * - If send time is the same regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * same message, and ignore the message received later. + * If the value is not provided, a new request will always be regarded as a + * new message without any de-duplication. + */ + // const messageSendTime = '' + /** + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function analyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + analyzeContent(); + // [END dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js new file mode 100644 index 00000000000..fa3f0df95d2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main() { + // [START dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. If zero or less than zero, 20 is used. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function compileSuggestion() { + // Construct request + const request = {}; + + // Run request + const response = await dialogflowClient.compileSuggestion(request); + console.log(response); + } + + compileSuggestion(); + // [END dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js new file mode 100644 index 00000000000..1e0dafd5fc2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js @@ -0,0 +1,59 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, participant) { + // [START dialogflow_v2beta1_generated_Participants_CreateParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = '' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function createParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + createParticipant(); + // [END dialogflow_v2beta1_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js new file mode 100644 index 00000000000..98163612354 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js @@ -0,0 +1,54 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Participants_GetParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function getParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + getParticipant(); + // [END dialogflow_v2beta1_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js new file mode 100644 index 00000000000..a350dacafd6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_ListParticipants_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function listParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listParticipants(); + // [END dialogflow_v2beta1_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js new file mode 100644 index 00000000000..22129daf5a7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js @@ -0,0 +1,73 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main() { + // [START dialogflow_v2beta1_generated_Participants_ListSuggestions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function listSuggestions() { + // Construct request + const request = {}; + + // Run request + const iterable = await dialogflowClient.listSuggestionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listSuggestions(); + // [END dialogflow_v2beta1_generated_Participants_ListSuggestions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js new file mode 100644 index 00000000000..e3f3e96e32d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestArticles_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message] to use as context + * when compiling the suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function suggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + suggestArticles(); + // [END dialogflow_v2beta1_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..ff7419af66c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js @@ -0,0 +1,67 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function suggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + suggestFaqAnswers(); + // [END dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js new file mode 100644 index 00000000000..259ca77ddd1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js @@ -0,0 +1,73 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + */ + // const currentTextInput = '' + /** + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function suggestSmartReplies() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestSmartReplies(request); + console.log(response); + } + + suggestSmartReplies(); + // [END dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js new file mode 100644 index 00000000000..0ef6f16f1c2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(participant, updateMask) { + // [START dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The participant to update. + */ + // const participant = '' + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function updateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + updateParticipant(); + // [END dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..56f85597e72 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to create a session entity type for. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = '' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function createSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + createSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..0907aae9a10 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function deleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + deleteSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..4e3ee7d2ab2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js @@ -0,0 +1,65 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session entity type. Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function getSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + getSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..0bfe7136867 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js @@ -0,0 +1,78 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function listSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync( + request + ); + for await (const response of iterable) { + console.log(response); + } + } + + listSessionEntityTypes(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..d4b0f42ac68 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js @@ -0,0 +1,57 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The session entity type to update. + */ + // const sessionEntityType = '' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = + require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function updateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + updateSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js new file mode 100644 index 00000000000..e6356276c16 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js @@ -0,0 +1,105 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_DetectIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session this query is sent to. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment + * (`Environment ID` might be referred to as environment name at some places). + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * The length of the `Session ID` and `User ID` must not exceed 36 characters. + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = '' + /** + * Required. The input specification. It can be set to: + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = '' + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = '' + /** + * Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = '' + /** + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function detectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + detectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..b7e6bc05cab --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js @@ -0,0 +1,127 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the session the query is sent to. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * The length of the `Session ID` and `User ID` must not exceed 36 characters. + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = '' + /** + * Required. The input specification. It can be set to: + * 1. an audio config which instructs the speech recognizer how to process + * the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = '' + /** + * DEPRECATED. Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] instead. + * If `false` (default), recognition does not cease until the + * client closes the stream. + * If `true`, the recognizer will detect a single spoken utterance in input + * audio. Recognition ceases when it detects the audio's voice has + * stopped or paused. In this case, once a detected intent is received, the + * client should close the stream and start a new request with a new stream as + * needed. + * This setting is ignored when `query_input` is a piece of text or an event. + */ + // const singleUtterance = true + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = '' + /** + * Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = '' + /** + * The input audio content to be recognized. Must be sent if + * `query_input` was set to a streaming input audio config. The complete audio + * over all streaming messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function streamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', response => { + console.log(response); + }); + stream.on('error', err => { + throw err; + }); + stream.on('end', () => { + /* API call completed */ + }); + stream.write(request); + stream.end(); + } + + streamingDetectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js new file mode 100644 index 00000000000..f7dca439df6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js @@ -0,0 +1,60 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent, version) { + // [START dialogflow_v2beta1_generated_Versions_CreateVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = '' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function createVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + createVersion(); + // [END dialogflow_v2beta1_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js new file mode 100644 index 00000000000..7476b5a4953 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Versions_DeleteVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function deleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + deleteVersion(); + // [END dialogflow_v2beta1_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js new file mode 100644 index 00000000000..b3237c0db91 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js @@ -0,0 +1,56 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(name) { + // [START dialogflow_v2beta1_generated_Versions_GetVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function getVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + getVersion(); + // [END dialogflow_v2beta1_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js new file mode 100644 index 00000000000..4d8673cd84f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js @@ -0,0 +1,66 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(parent) { + // [START dialogflow_v2beta1_generated_Versions_ListVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function listVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + listVersions(); + // [END dialogflow_v2beta1_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js new file mode 100644 index 00000000000..17c200d0282 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js @@ -0,0 +1,61 @@ +// Copyright 2021 Google LLC +// +// 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. + +'use strict'; + +function main(version, updateMask) { + // [START dialogflow_v2beta1_generated_Versions_UpdateVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = '' + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = '' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function updateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + updateVersion(); + // [END dialogflow_v2beta1_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/src/v2/agents_client.ts b/packages/google-cloud-dialogflow/src/v2/agents_client.ts index 468540d4196..dbfdd13a9cc 100644 --- a/packages/google-cloud-dialogflow/src/v2/agents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/agents_client.ts @@ -1652,7 +1652,8 @@ export class AgentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAgents.createStream( this.innerApiCalls.searchAgents as gax.GaxCall, @@ -1704,7 +1705,8 @@ export class AgentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAgents.asyncIterate( this.innerApiCalls['searchAgents'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts b/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts index 88ac461883f..b276d23850b 100644 --- a/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts @@ -692,7 +692,8 @@ export class AnswerRecordsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAnswerRecords.createStream( this.innerApiCalls.listAnswerRecords as gax.GaxCall, @@ -756,7 +757,8 @@ export class AnswerRecordsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAnswerRecords.asyncIterate( this.innerApiCalls['listAnswerRecords'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/contexts_client.ts b/packages/google-cloud-dialogflow/src/v2/contexts_client.ts index 8a6308ade30..9380b8b5d61 100644 --- a/packages/google-cloud-dialogflow/src/v2/contexts_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/contexts_client.ts @@ -1064,7 +1064,8 @@ export class ContextsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listContexts.createStream( this.innerApiCalls.listContexts as gax.GaxCall, @@ -1120,7 +1121,8 @@ export class ContextsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listContexts.asyncIterate( this.innerApiCalls['listContexts'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts index cefe9c68dae..ac011e8e317 100644 --- a/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts @@ -1002,7 +1002,8 @@ export class ConversationProfilesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversationProfiles.createStream( this.innerApiCalls.listConversationProfiles as gax.GaxCall, @@ -1054,7 +1055,8 @@ export class ConversationProfilesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversationProfiles.asyncIterate( this.innerApiCalls['listConversationProfiles'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/conversations_client.ts b/packages/google-cloud-dialogflow/src/v2/conversations_client.ts index 71cf1c0d35e..5b42c52c409 100644 --- a/packages/google-cloud-dialogflow/src/v2/conversations_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/conversations_client.ts @@ -933,7 +933,8 @@ export class ConversationsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversations.createStream( this.innerApiCalls.listConversations as gax.GaxCall, @@ -1003,7 +1004,8 @@ export class ConversationsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversations.asyncIterate( this.innerApiCalls['listConversations'] as GaxCall, @@ -1172,7 +1174,8 @@ export class ConversationsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listMessages.createStream( this.innerApiCalls.listMessages as gax.GaxCall, @@ -1234,7 +1237,8 @@ export class ConversationsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listMessages.asyncIterate( this.innerApiCalls['listMessages'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/documents_client.ts b/packages/google-cloud-dialogflow/src/v2/documents_client.ts index 1447f5dd2b3..8f7b6b83f62 100644 --- a/packages/google-cloud-dialogflow/src/v2/documents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/documents_client.ts @@ -1349,7 +1349,8 @@ export class DocumentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDocuments.createStream( this.innerApiCalls.listDocuments as gax.GaxCall, @@ -1402,7 +1403,8 @@ export class DocumentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDocuments.asyncIterate( this.innerApiCalls['listDocuments'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts index 2425a6d5f97..6446d5b6124 100644 --- a/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts @@ -1898,7 +1898,8 @@ export class EntityTypesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEntityTypes.createStream( this.innerApiCalls.listEntityTypes as gax.GaxCall, @@ -1956,7 +1957,8 @@ export class EntityTypesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEntityTypes.asyncIterate( this.innerApiCalls['listEntityTypes'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/environments_client.ts b/packages/google-cloud-dialogflow/src/v2/environments_client.ts index baf35a37b6d..5e6352972e7 100644 --- a/packages/google-cloud-dialogflow/src/v2/environments_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/environments_client.ts @@ -993,7 +993,8 @@ export class EnvironmentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEnvironments.createStream( this.innerApiCalls.listEnvironments as gax.GaxCall, @@ -1048,7 +1049,8 @@ export class EnvironmentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEnvironments.asyncIterate( this.innerApiCalls['listEnvironments'] as GaxCall, @@ -1199,7 +1201,8 @@ export class EnvironmentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.getEnvironmentHistory.createStream( this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, @@ -1257,7 +1260,8 @@ export class EnvironmentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.getEnvironmentHistory.asyncIterate( this.innerApiCalls['getEnvironmentHistory'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/intents_client.ts b/packages/google-cloud-dialogflow/src/v2/intents_client.ts index c86744fe59a..475d20fc869 100644 --- a/packages/google-cloud-dialogflow/src/v2/intents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/intents_client.ts @@ -1357,7 +1357,8 @@ export class IntentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listIntents.createStream( this.innerApiCalls.listIntents as gax.GaxCall, @@ -1425,7 +1426,8 @@ export class IntentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listIntents.asyncIterate( this.innerApiCalls['listIntents'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts index faa04d1943f..cc1afec5a75 100644 --- a/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts @@ -955,7 +955,8 @@ export class KnowledgeBasesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listKnowledgeBases.createStream( this.innerApiCalls.listKnowledgeBases as gax.GaxCall, @@ -1007,7 +1008,8 @@ export class KnowledgeBasesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listKnowledgeBases.asyncIterate( this.innerApiCalls['listKnowledgeBases'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/participants_client.ts b/packages/google-cloud-dialogflow/src/v2/participants_client.ts index 4a33fdb64db..5880a798ba0 100644 --- a/packages/google-cloud-dialogflow/src/v2/participants_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/participants_client.ts @@ -1184,7 +1184,8 @@ export class ParticipantsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listParticipants.createStream( this.innerApiCalls.listParticipants as gax.GaxCall, @@ -1237,7 +1238,8 @@ export class ParticipantsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listParticipants.asyncIterate( this.innerApiCalls['listParticipants'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts index 34dbd2cef24..9d4726f54d3 100644 --- a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts @@ -1036,7 +1036,8 @@ export class SessionEntityTypesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSessionEntityTypes.createStream( this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, @@ -1092,7 +1093,8 @@ export class SessionEntityTypesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSessionEntityTypes.asyncIterate( this.innerApiCalls['listSessionEntityTypes'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2/versions_client.ts b/packages/google-cloud-dialogflow/src/v2/versions_client.ts index bb6c7cc6360..893a0858650 100644 --- a/packages/google-cloud-dialogflow/src/v2/versions_client.ts +++ b/packages/google-cloud-dialogflow/src/v2/versions_client.ts @@ -970,7 +970,8 @@ export class VersionsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listVersions.createStream( this.innerApiCalls.listVersions as gax.GaxCall, @@ -1025,7 +1026,8 @@ export class VersionsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listVersions.asyncIterate( this.innerApiCalls['listVersions'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts index 4176fd01339..9a450166778 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts @@ -1689,7 +1689,8 @@ export class AgentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAgents.createStream( this.innerApiCalls.searchAgents as gax.GaxCall, @@ -1742,7 +1743,8 @@ export class AgentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['searchAgents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.searchAgents.asyncIterate( this.innerApiCalls['searchAgents'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts index caedd9725f6..afc483abc86 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts @@ -791,7 +791,8 @@ export class AnswerRecordsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAnswerRecords.createStream( this.innerApiCalls.listAnswerRecords as gax.GaxCall, @@ -848,7 +849,8 @@ export class AnswerRecordsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listAnswerRecords.asyncIterate( this.innerApiCalls['listAnswerRecords'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts index 48153128a01..43917f9b137 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts @@ -1120,7 +1120,8 @@ export class ContextsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listContexts.createStream( this.innerApiCalls.listContexts as gax.GaxCall, @@ -1183,7 +1184,8 @@ export class ContextsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listContexts']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listContexts.asyncIterate( this.innerApiCalls['listContexts'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts index 68086453129..c7c0d0e55e6 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts @@ -1006,7 +1006,8 @@ export class ConversationProfilesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversationProfiles.createStream( this.innerApiCalls.listConversationProfiles as gax.GaxCall, @@ -1058,7 +1059,8 @@ export class ConversationProfilesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversationProfiles.asyncIterate( this.innerApiCalls['listConversationProfiles'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts index 36a82c525f8..847a37c7d37 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts @@ -1050,7 +1050,8 @@ export class ConversationsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversations.createStream( this.innerApiCalls.listConversations as gax.GaxCall, @@ -1120,7 +1121,8 @@ export class ConversationsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listConversations']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listConversations.asyncIterate( this.innerApiCalls['listConversations'] as GaxCall, @@ -1289,7 +1291,8 @@ export class ConversationsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listMessages.createStream( this.innerApiCalls.listMessages as gax.GaxCall, @@ -1351,7 +1354,8 @@ export class ConversationsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listMessages']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listMessages.asyncIterate( this.innerApiCalls['listMessages'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts index 41821b41012..d6cc7a45d53 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts @@ -1596,7 +1596,8 @@ export class DocumentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDocuments.createStream( this.innerApiCalls.listDocuments as gax.GaxCall, @@ -1671,7 +1672,8 @@ export class DocumentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listDocuments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listDocuments.asyncIterate( this.innerApiCalls['listDocuments'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts index 2f1f9bfe83a..d712d68fc78 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts @@ -1940,7 +1940,8 @@ export class EntityTypesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEntityTypes.createStream( this.innerApiCalls.listEntityTypes as gax.GaxCall, @@ -2000,7 +2001,8 @@ export class EntityTypesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEntityTypes.asyncIterate( this.innerApiCalls['listEntityTypes'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts index 86c394d02d8..669a6caf063 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts @@ -1002,7 +1002,8 @@ export class EnvironmentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEnvironments.createStream( this.innerApiCalls.listEnvironments as gax.GaxCall, @@ -1056,7 +1057,8 @@ export class EnvironmentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listEnvironments.asyncIterate( this.innerApiCalls['listEnvironments'] as GaxCall, @@ -1207,7 +1209,8 @@ export class EnvironmentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.getEnvironmentHistory.createStream( this.innerApiCalls.getEnvironmentHistory as gax.GaxCall, @@ -1262,7 +1265,8 @@ export class EnvironmentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.getEnvironmentHistory.asyncIterate( this.innerApiCalls['getEnvironmentHistory'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts index 701aa88fc96..96322660381 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts @@ -1403,7 +1403,8 @@ export class IntentsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listIntents.createStream( this.innerApiCalls.listIntents as gax.GaxCall, @@ -1471,7 +1472,8 @@ export class IntentsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listIntents']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listIntents.asyncIterate( this.innerApiCalls['listIntents'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts index bee58b68df5..a2eed2b7d7e 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts @@ -1048,7 +1048,8 @@ export class KnowledgeBasesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listKnowledgeBases.createStream( this.innerApiCalls.listKnowledgeBases as gax.GaxCall, @@ -1127,7 +1128,8 @@ export class KnowledgeBasesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listKnowledgeBases.asyncIterate( this.innerApiCalls['listKnowledgeBases'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts index dba25c20fe4..9c233407565 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts @@ -1471,7 +1471,8 @@ export class ParticipantsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listParticipants.createStream( this.innerApiCalls.listParticipants as gax.GaxCall, @@ -1524,7 +1525,8 @@ export class ParticipantsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listParticipants']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listParticipants.asyncIterate( this.innerApiCalls['listParticipants'] as GaxCall, @@ -1715,7 +1717,8 @@ export class ParticipantsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSuggestions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); this.warn( 'DEP$Participants-$ListSuggestions', @@ -1783,7 +1786,8 @@ export class ParticipantsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSuggestions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); this.warn( 'DEP$Participants-$ListSuggestions', diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts index 24112aac513..da650030901 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts @@ -1076,7 +1076,8 @@ export class SessionEntityTypesClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSessionEntityTypes.createStream( this.innerApiCalls.listSessionEntityTypes as gax.GaxCall, @@ -1140,7 +1141,8 @@ export class SessionEntityTypesClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listSessionEntityTypes.asyncIterate( this.innerApiCalls['listSessionEntityTypes'] as GaxCall, diff --git a/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts index 98a22ee1fe1..a164fd380d5 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts +++ b/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts @@ -970,7 +970,8 @@ export class VersionsClient { gax.routingHeader.fromParams({ parent: request.parent || '', }); - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listVersions.createStream( this.innerApiCalls.listVersions as gax.GaxCall, @@ -1024,7 +1025,8 @@ export class VersionsClient { parent: request.parent || '', }); options = options || {}; - const callSettings = new gax.CallSettings(options); + const defaultCallSettings = this._defaults['listVersions']; + const callSettings = defaultCallSettings.merge(options); this.initialize(); return this.descriptors.page.listVersions.asyncIterate( this.innerApiCalls['listVersions'] as GaxCall,